<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mikey on Medium]]></title>
        <description><![CDATA[Stories by Mikey on Medium]]></description>
        <link>https://medium.com/@transcendmikey?source=rss-e0f2e67bba64------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rJhOlZP7-5RvzyT953Qemw@2x.jpeg</url>
            <title>Stories by Mikey on Medium</title>
            <link>https://medium.com/@transcendmikey?source=rss-e0f2e67bba64------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 01:24:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@transcendmikey/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Journey to Enjoyable, Maintainable Styling with React, ITCSS, and CSS-in-JS]]></title>
            <link>https://medium.com/maintainable-react-apps/journey-to-enjoyable-maintainable-styling-with-react-itcss-and-css-in-js-632cfa9c70d6?source=rss-e0f2e67bba64------2</link>
            <guid isPermaLink="false">https://medium.com/p/632cfa9c70d6</guid>
            <category><![CDATA[aphrodite]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Mikey]]></dc:creator>
            <pubDate>Mon, 08 Aug 2016 17:00:40 GMT</pubDate>
            <atom:updated>2016-08-08T19:27:54.486Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zaBGe5-EZTddOll8qyPbww.jpeg" /></figure><p><em>Knowing why humans do what they do fascinates me, and many times I learn much more from the path leading to a conclusion than I do from the conclusion itself. I’ve chosen to include my learning journey in this post in hopes that it may provide valuable context to the conclusion and resonate with your respective learning journeys.</em></p><h4>Content</h4><ol><li>Context</li><li>Making Styling Better With better CSS</li><li>Making Styling Better With Components</li><li>Making Styling Better With JavaScript</li><li>Current Approach With ITCSS and Aphrodite</li></ol><h3>Context</h3><p>I lead a team actively developing for and maintaining a 15-month-old react application of non-trivial size. So while Ryan’s tweet remains mostly true,</p><h3>Ryan Florence on Twitter</h3><p>PSA: You have no clue how to make styling your web app productive, scalable, straightforward to maintain. Nobody does, so let people explore</p><p>not only has it been some time since we’ve felt the traditional pains of styling we tend to glean morbid amusement from…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*0nfVMXAmds8FX2B8GcaHIQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*ZPlE0Td0GCO2mt3Ivrmp5g.gif" /></figure><h3></h3><p>CSS is easy. It&#39;s like riding a bike, which is on fire and the ground is on fire and everything is on fire because it is hell.</p><p>but our current styling story is straight up enjoyable. Indulge me as I share how we got here.</p><h4>Author Bias Calibrator</h4><p>I’m a pixel guy, and a real sucker for quality aesthetics. Want me to choose your product over another and pay a premium for it? Make it look good. Primary reason I roll with <a href="http://standardjs.com/">standardjs</a> for everything? I think my JS looks prettier without the eyesores known as semi-colons #correctopinion.</p><p>To boot, things like bootstrap (did you see the pun back there? 😳) are demonstrably out of the question for me on account of being a 1/4th hipster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*ckv3LTlhB6Q3G_jEwsznkw.gif" /><figcaption>Styling evolutionary journey 👀.</figcaption></figure><p>So despite the path to CSS enlightenment basically being a giant thorn-bush maze set up by someone in charge of organizing the Tri-Wizard Tournament, I channel my inner masochist and press forward like there is a Dragonite augmenting reality at the finish.</p><p>Let’s enter the maze.</p><h3>Making Styling better with better CSS</h3><p>Do you remember when you were first learning CSS? Early CSS me is rather adorable, but with time and effort I figured out how in the world the <strong>box model</strong> worked and that <strong>`position: absolute;`</strong> <em>all the things</em> was a bad idea. From that point on, making my pixels do what I wanted was a relatively straightforward <a href="https://css-tricks.com/">CSS-Tricks</a> search away.</p><p>What was an absolute unstraightforward (totally a word) nightmare though? Keeping markup and their accompanying stylesheets sane. This was the case for me even considering at the time I was neither working on very complex UX nor sharing a codebase with anyone.</p><p>Behold a snapshot of literal CSS I once was quite proud of spawning:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eilpm7IKG6mfgbzSB7dniw.png" /></figure><p>Before long, I was yearning for my code to be as pretty as my pixels.</p><h4>The Oracles</h4><p>So I consulted CSS oracles the likes of <a href="http://nicolasgallagher.com/">Nicolas Gallagher</a> (<a href="https://suitcss.github.io/">suitcss</a>), <a href="https://twitter.com/stubbornella">Nicole Sullivan</a> (<a href="https://github.com/stubbornella/oocss/wiki">OOCSS</a>), <a href="https://twitter.com/snookca">Jonathan Snook</a> (<a href="https://smacss.com/">SMACSS</a>), <a href="https://twitter.com/brad_frost">Brad Frost</a> (<a href="http://bradfrost.com/blog/post/atomic-web-design/">Atomic Design</a>), <a href="https://twitter.com/LeaVerou">Lea Verou</a> (<a href="https://twitter.com/csssecretsbook?lang=en">CSS Secrets</a>), <a href="https://twitter.com/mdo">Mark Otto</a> (<a href="http://getbootstrap.com/">bootstrap</a>), and <a href="https://twitter.com/mrmrs_">mrmrs</a> (<a href="http://tachyons.io/">tachyons</a>) to name several.</p><p>I experimented a lot. My favorite experiment was probably <a href="https://twitter.com/glenmaddern">Glen Maddern</a>’s “<a href="http://glenmaddern.com/articles/introducing-am-css">Attribute Modules</a>” approach:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*mrFxJb8iAXMoZfykCjMyOw.png" /><figcaption>I had our team use this exclusively on an earlier Angular app and loved it. Markup remind you of anything?</figcaption></figure><p>I drew upon the Oracles’ collective body of CSS wisdom and experience to inch towards CSS nirvana. I learned a Pokemon Go server-size load from them, plucking out best practices like <a href="http://nicolasgallagher.com/about-html-semantics-front-end-architecture/">BEM naming convention</a> or tools like SASS as I went.</p><h4>CSS Wizardry &amp; ITCSS</h4><p>Of the oracles I consulted, <a href="http://csswizardry.com/">Harry Roberts</a> (also appropriately known as <a href="https://twitter.com/csswizardry">csswizardry</a>), proved the most influential. By using his masterly crafted <a href="https://github.com/inuitcss/getting-started">inuitcss</a> framework, I became subliminally familiar with his system for organizing CSS known as the <a href="http://itcss.io/"><strong>ITCSS</strong> Architecture</a>.</p><p>Never heard of ITCSS? Don’t feel bad. Admittedly, recognition and resources don’t have a lot of visibility. Notwithstanding, ITCSS emerged as the simple and elegant methodology I was missing to introduce sanity to my stylesheets, and has proven to be my secret styling weapon.</p><h4>What is ITCSS?</h4><p>Harry explains best.</p><blockquote>ITCSS — which stands for Inverted Triangle CSS — is a fully managed CSS architecture. It’s not a framework or library; there’s nothing to download or install.</blockquote><blockquote>It’s a collection of principles and metrics by which developers should group and order their CSS in order to keep it scalable, terse, logical, and manageable.</blockquote><blockquote>— Harry Roberts, <a href="http://www.creativebloq.com/web-design/manage-large-scale-web-projects-new-css-architecture-itcss-41514731">Manage large-scale web projects with new CSS architecture ITCSS</a></blockquote><p>The layered methodology was born to address two categories of imperfection when building large scale apps:</p><ol><li>Shortcomings inherent in CSS the <em>language</em></li><li>Shortcomings inherent in human developers</li></ol><p>ITCSS is designed to:</p><ul><li>Create a sane environment that is accessible to lots of people</li><li>Tame and manage source order and the cascade (CSS specific)</li><li>Create a place for every (new and old) style to live</li><li>Reduce waste and redundancy</li><li>End “Specificity Wars” (CSS specific)</li></ul><p>ITCSS does this by inviting us to think in terms of specificity starting from far-reaching, app-wide styling to granular, single-element effected styling. Hence the “Inverted Triangle.”</p><p>What it ends up looking like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Xhi7zBs-ZEON9HfCfFQg3A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HumzNVJq5XVniCu1HiMgMQ.jpeg" /></figure><p>Despite largely being designed to address <em>CSS the language</em> weaknesses, we’ll see later how the ITCSS methodology transcends nicely when we start removing CSS from the styling equation.</p><p>For brevity, I’ll end <em>my</em> “Intro to ITCSS” and direct you to one of those “inconspicuous” resources I recently discovered: <a href="http://www.hongkiat.stfi.re/blog/inverted-triangle-css-web-development/?sf=yrroxpk&amp;utm_content=buffere3cce&amp;utm_medium=social&amp;utm_source=twitter.com&amp;utm_campaign=buffer#ab">Intro to ITCSS for Web Developers</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*uDY7uewjqsnktYTBDTA4jA.jpeg" /><figcaption>🤗</figcaption></figure><p>Harry Roberts and the oracles brought me a little closer to CSS nirvana. Where there use to be haphazard rhyme and reason strewn across a single stylesheet, I was greeted by carefully constructed methodology, convention, and tooling. Yet, at the other end of the whirlwind oracle consumption, I couldn’t help but feel like CSS deserved it’s own bachelor’s degree.</p><h3>Making Styling Better With Components</h3><blockquote>Fundamentally I think there are problems beyond the scope of solutions that CSS Specialists can come up with.</blockquote><h4>The Nicolas Gallagher Confession</h4><p>It was Christmas vacation 2014, and I was taking advantage of the reprieve from the family “we must be doing something at all times or we’re wasting valuable vacation time” pressure by watching a presentation given by another heavy influence, Nicolas Gallagher. The talk took place at dotCSS the month prior and is entitled <a href="https://www.youtube.com/watch?v=L8w3v9m6G04"><em>Thinking Beyond “Scalable CSS</em>.”</a></p><p>Sharing his own learning journey, Nicolas proceeded to simultaneously trigger imposter syndrome and induce me with FOMO. Within the first few minutes he admitted:</p><blockquote>I remember feeling anxious about… the things I championed on my blog… [and] how the decisions I make might negatively impact the lives of the people… who read the stuff that I wrote about.</blockquote><p><strong>OH.</strong> Oh good 😳. THAT’S ME!</p><p><a href="http://waitbutwhy.com/">Wait but why</a>? While Nicolas articulately details his reasoning in his presentation (seriously <a href="https://www.youtube.com/watch?v=L8w3v9m6G04">watch the first 3 minutes</a>. They’re gold.), the following soundbite captures the spirit of his confession nicely:</p><blockquote>We’ve often overdosed on CSS focused solutions and the creation of complicated systems that we expect other engineers who don’t specialize in CSS to understand… Including teams of great engineers.</blockquote><p>Well great. What do you propose we do now Mr. Gallagher?</p><blockquote>The work that we’re [now] doing [at Twitter] is starting to see the UI module… as the primary unit of scale. The foundational building block of applications.</blockquote><p>He explained, in the abstract, how they were using these discrete component things with well defined APIs to manage complexity and encapsulate styles. Unfortunately he never bothered to explain <em>how</em> they were able to do that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O2gLbq63kgz4jBwkQtPvPw.png" /><figcaption>Examples of Twitter’s component organization from Nicolas’s presentation.</figcaption></figure><p>He also mentioned something about building a dependency tree of all these components that magically rolled them all up along with their styles using something called “Webpack.” Well that sounded fancy, but considering I was barely getting the hang of grunt and wasn’t Twitter engineer smart, it also sounded well beyond me.</p><p>By the end, my mind was left buzzing with new ideas and possibilities, but with no clear technologies I could adopt to help me. I did my best to apply the principles and concepts surrounding “components” to an Angular application I was architecting at the time, but ultimately it felt incredibly lackluster in relation to the utopia Nicolas described.</p><h4>The New Girl</h4><p>Have you ever determined to end a long-time relationship with someone (you really liked) minutes into first interacting with someone new? I have. Well… only if you count the first time I played with React after Angular and I had been seeing each other pretty seriously for a little over a year.</p><p>My introduction to React took place a couple months <em>after</em> Nicolas had exposed my mind to thinking of components as the “primary unit of scale,” which in retrospect may very well be why I was sold so quickly. So despite the paradoxical sadness of leaving Angular behind, I only wish React and I had met sooner.</p><h3>Michael Chan on Twitter</h3><p>How do we inform all these folks that have styled HTML for the past 15 years that they have components now?</p><p>The developer experience for styling a large codebase went from 👌 to awesome largely by doing no more than adopting React + <a href="https://webpack.github.io/">Webpack</a>.</p><h4>CSS + Components === ❤</h4><p>Many of CSS’s lingering pain points melted away by organizing styles with their accompanying components. For example, you can easily avoid global namespace clashing by applying BEM naming convention using the component name as the “Block.”</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad0ad57ab7a823cd2a9a2ac50be3f151/href">https://medium.com/media/ad0ad57ab7a823cd2a9a2ac50be3f151/href</a></iframe><p>Shortly after adopting Webpack we began using <a href="http://glenmaddern.com/articles/css-modules">CSS Modules</a> to move this component/style relationship from implicit to explicit:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3666d19cb734f9abbe0f47eefc782ca7/href">https://medium.com/media/3666d19cb734f9abbe0f47eefc782ca7/href</a></iframe><p>We also dropped SASS in favor of <a href="http://cssnext.io/">cssnext</a>, but if I’m being honest, switching to these technologies did just as much for the <em>look at my cutting edge tech stack</em> ego as they did to objectively improve our developer experience.</p><p>Components as the primary unit of scale are the real MVPs here.</p><h3>Making Styling better with JavaScript</h3><h3>Mark Dalgleish on Twitter</h3><p>@kentcdodds &quot;Here&#39;s a made-up programming language that compiles to CSS&quot; Devs: &quot;I&#39;m just gonna use JS&quot; Devs:</p><h4>¿¡CSS in JS!?</h4><p>Applause please for Christopher “<a href="https://twitter.com/Vjeux">vjuex</a>” Chedeau for officially rocking the CSS boat with his seminal “<a href="https://speakerdeck.com/vjeux/react-css-in-js">React: CSS in JS</a>” 👏👏👏. I enjoy picturing Christopher taking a bat to the beehive that can on occasion bee 👀 the web development community. Chris gave visibility to this new frontier of styling while simultaneously sending off a fleet of developer explorers to go do great things.</p><p>The prospect of styling with JavaScript was exciting. Why? Glad I asked for you. Here are a few reasons:</p><ul><li><strong>Context Switching:</strong> As vast as an improvement organizing CSS with their accompanying components was… styling still required switching back and forth not only from different files but also from two very different languages and syntaxes. This carries with it an under appreciated amount of mental overhead.</li><li><strong>Co-Location is Love:</strong> What can I say? JSX spoiled me. While avoiding file context switching is, I believe, objectively superior, there is so much about having everything in one file that feels so subjectively nice.</li><li><strong>JavaScript!!!: </strong>JavaScript is far more expressive than CSS (or any other “precompiled” CSS language for that matter. Not sure this needs much explaining. I laugh when I consider the mental strain I would go through to try and pull off in CSS what could be so simply and easily accomplished with a basic function or data structure in JS.</li><li><strong>Publishing Styled Components</strong>: I want zero things to do with trying to wrangle a 3rd party stylesheet in to my codebase just to use a component. Not worth it. I don’t have to hassle with that if your component is styled with JS.</li></ul><p>Within months, “inline-styles” took on viability. Pioneers like Michael Chan (check out his <a href="https://www.youtube.com/watch?v=ERB1TJBn32c">React Europe talk</a> on the topic) and technologies like <a href="https://github.com/FormidableLabs/radium">Radium</a> aided in giving birth to the “inline-style” revolution.</p><p>For the uninitiated, here are what inline-styles look like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc2c34917a4fe85e96c6dc71b2e8b8fd/href">https://medium.com/media/bc2c34917a4fe85e96c6dc71b2e8b8fd/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Im9dEMRIz55AFl0uAQ6xHA.png" /><figcaption>Output in DOM</figcaption></figure><p>Inline-styles are so handy for quick and simple styling when the context-switch isn’t worth it, but I never reached a point where I believed I could use them as a comprehensive solution. The various implementations came with unfortunate tradeoffs when trying to deal with challenges like vendor prefixing, media queries, or pseudo styling (:hover). Purely inline-style solutions ultimately felt too incomplete and/or over-engineered to prefer over CSS Modules.</p><h4>New Girl Part Duex: The Goddess Of Beauty</h4><p>As almost all good things in my developer life, <a href="https://github.com/Khan/aphrodite">Aphrodite</a> low-key showed up in my Twitter feed (one of the <a href="https://medium.com/@TranscendMikey/surround-yourself-with-the-best-in-the-twroom-4945cbc5c82e#.kz3rhny28">reasons I consider Twitter to be invaluable</a>).</p><p>Here she is:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/290a420bdf36f249f5fff679b604d20c/href">https://medium.com/media/290a420bdf36f249f5fff679b604d20c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iPnRr7rBq8U46WOu-OKmBg.png" /><figcaption>Output in DOM.</figcaption></figure><p>Note the differences in output between inline-styles and Aphrodite. There are several significant ones I’ll leave you to find. The one I’ll focus on is that you’re seeing the styles extracted into a stylesheet (placed by Aphrodite in the &lt;head/&gt;) rather than inlined into the element. Rather than try to re-engineer CSS using JS DOM apis like `onMouseOver,` Aphrodite uses JS as the medium by which a CSS stylesheet is created.</p><h3>Kent C. Dodds on Twitter</h3><p>Things I don&#39;t care/think about anymore: - CSS Specificity - CSS Linters - CSS Preprocessors - CSS Vendor Prefixinghttp://npm.im/aphrodite</p><p>Aphrodite comes with all the benefits of styling with JS without many of the tradeoffs accompanying inline-styles. The turn-around time for learning about Aphrodite and then Aphrodite making its way to our production codebase (aphrodite is 6kb gzipped) was about 48 hours. Among the top reasons for that was it was easy. I didn’t have to do any rewriting or abandon legacy methods to accommodate this new mode of styling.</p><pre>new feature -&gt; npm i -S aphrodite -&gt; import -&gt; profit</pre><p>A Couple Tradeoffs To Note:</p><p>1. CSS selectors seem pretty handy sometimes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/94f7f200d96cdba63827291e3585233a/href">https://medium.com/media/94f7f200d96cdba63827291e3585233a/href</a></iframe><p>2. Styling by tagname or with things like “*” <a href="https://github.com/Khan/aphrodite/issues/30">not supported</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/17b0b330410fbc28d219515099f93b4b/href">https://medium.com/media/17b0b330410fbc28d219515099f93b4b/href</a></iframe><h3>Current Approach With ITCSS and Aphrodite</h3><p>I believe we ask the wrong question when we are asking which technology to use for styling our applications. Often the debate is framed as CSS vs. CSS Modules vs. inline-styles vs. components vs Aphrodite. I believe a better question is <strong><em>which technology is best suited for the layer of the application I’m trying to style?</em></strong></p><h4>What’s ITCSS doing here?</h4><p>You may recall that I said ITCSS was designed to address shortcomings in CSS <em>the language</em>. So if those problems are no longer issues by primarily using JS instead why are we using ITCSS? ITCSS transcends quite nicely into CSS-in-JS oriented styling for two reasons:</p><ol><li>ITCSS helps answer for us which technology is best suited for the layer of the application we’re trying to style.<strong><em> </em></strong>Instead of thinking in terms of technology, ITCSS helps us think in terms of styling layers. We’ll see that the candidates shine differently in different parts the “inverted triangle.”</li><li>ITCSS was also designed with <em>developers</em> in mind. Of the methodology goals mentioned earlier, ITCSS still helps us to:</li></ol><ul><li>Create a sane environment that is accessible to lots of people</li><li>Create a place for everything to live (new and old)</li><li>Reduce waste and redundancy</li></ul><h4>Overview</h4><p><strong>Current implementation details</strong></p><ul><li>ITCSS: Organization / Architecture</li><li><a href="https://github.com/Khan/aphrodite">Aphrodite</a>: 99% of view / component styling</li><li><a href="http://cssnext.io/">CSSNext</a> + <a href="http://glenmaddern.com/articles/css-modules">CSSModule</a>s: Global / Reset / Escape-hatch styling</li><li>React: Encapsulate reusable styles via components</li><li>Tooling — Webpack, Babel, postcss</li></ul><p><strong>Customized “Inverted Triangle”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WAw0ViiRBaJIz0iOTRFYSA.png" /></figure><p>If you compare <em>my</em> “IT” with the standard one you’ll notice `Tools` got moved below `Generic` and `Elements` for reasons I explain in that section.</p><p>One thing to note is that the ITCSS methodology is a flexible one that can be suited to your preferences. A particular “default” layer doesn’t work for you? Move it around or throw it out. Your particular product requires a lot of theming? Add a `Themes` layer where it makes sense. Think a layer’s name sucks? Change it.</p><p><strong>Assumed File Structure</strong></p><p>For a frame of reference we will assume <a href="https://medium.com/maintainable-react-apps/react-apps-approaching-organization-structure-architecture-49a281bd97eb#.ib9awhnvv">this feature-centric project organization approach</a> and the following folder structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h4QYI2FenhdKhbMP-u1YtQ.jpeg" /></figure><p>The example code snippets will include the absolute path in which I would place them within this folder structure.</p><h4>Settings</h4><ul><li>Globally-available settings.</li><li>Config switches.</li><li>Brand colors, etc.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DFEkUYGzCZx6Zr555kW0Xg.png" /></figure><p>Here is where I place values I want to remain consistent throughout an application. Instead of thinking in hex values, pixel units, and media query syntax, I can think in descriptive variable names. `Settings` is my single location control panel for making application-wide changes.</p><p>`Settings` in JavaScript:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8718be0001daa407723302e17bd4e698/href">https://medium.com/media/8718be0001daa407723302e17bd4e698/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/278493c4858b6a31930c8564dec81e13/href">https://medium.com/media/278493c4858b6a31930c8564dec81e13/href</a></iframe><p>`Settings` in CSS:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc2a87af96d9c1d68021e926b8e56f67/href">https://medium.com/media/fc2a87af96d9c1d68021e926b8e56f67/href</a></iframe><p>A note about using `settings` in CSS:</p><p>Maintaining two separate settings files, one for JS (`settings.js`) and one for CSS (`settings.css`), runs counter to one of the virtues of the concept of settings: having a single source of truth. You now have two files that easily can get out of sync without discipline. This pain point can be solved by investing some time into a `post-css` plugin that allow the CSS to pull its variables from the JS settings file.</p><h4>Generic</h4><ul><li>Ground zero styles</li><li>Low-specificity, far-reaching, app-wide</li><li>Resets, Normalize.css, etc.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GurcKh0HB446FAnCfzm8WQ.png" /></figure><p>I use `generic` styling primarily for <a href="http://cssreset.com/what-is-a-css-reset/">CSS resets</a> and cross-browser style normalization. CSS is our starting quarterback here not only because it’s perfectly suited to do far-reaching styles, but also because it’s our only quarterback. These styles are applied via tagnames and pseudo-elements whose targeting is <a href="https://github.com/Khan/aphrodite/issues/30">not supported by Aphrodite</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c51e26a4c4647d12821a65bdcad48e4/href">https://medium.com/media/1c51e26a4c4647d12821a65bdcad48e4/href</a></iframe><p>I let smarter humans do the thinking on this and borrow most of <a href="https://github.com/inuitcss/inuitcss/tree/develop/generic">these</a>. I carry nearly the same `generic` styling over to every project.</p><h4>Elements</h4><ul><li>HTML Elements.</li><li>H1-H6, basic links, lists, etc.</li><li>More opinionated / “stylistic” than `generic`.</li><li>Last layer we see type selectors (e.g. a {}, blockquote {}).</li><li>Use CSS or React depending on case.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EPBXXxkzw2Q5iOr72eLubQ.png" /></figure><p>The difference between `elements` and `generic` for me is that `elements` styling is more stylistically opinionated. While I would generally carry `generic` styling over from project to project, I would refrain from doing that with most `elements`styling. The other thing to note here is whether or not to use CSS or JS to apply `elements` style is in a bit of a grey area for me.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/afca9322da24f24348acdc4debd0e5fa/href">https://medium.com/media/afca9322da24f24348acdc4debd0e5fa/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c15191e0bed16efc300863210131ff96/href">https://medium.com/media/c15191e0bed16efc300863210131ff96/href</a></iframe><p>^ Why not just use CSS?</p><pre>button {<br> border: none;<br> outline: none;<br>}</pre><p>You could but…</p><ul><li>The relationship is implicit</li><li>May be too far-reaching / powerful: Effects <em>every</em> button including 3rd party</li></ul><p>Those are a couple of the tradeoffs I weigh when deciding how to apply `elements` style.</p><h4>Applying Generic and Element Styles</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/506fc5e213392f1aa7e3fbe27a622dba/href">https://medium.com/media/506fc5e213392f1aa7e3fbe27a622dba/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b7809b868739e18f0150c6333c0b77d5/href">https://medium.com/media/b7809b868739e18f0150c6333c0b77d5/href</a></iframe><p>With a webpack (or any other module bundler really) setup, simply importing the CSS file to a top level component file will cause the CSS to be bundled into a single stylesheet for you to include in your index.html.</p><h4>Tools</h4><ul><li>Globally-available helper functions</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hsmxz3S1T1uQlu_kPmuRHg.png" /></figure><p>`Tools` is a layer where I really ask myself why styling with JS hasn’t been a thing long before now. CSS (SASS, et al) is not the place to be writing logic. This is why I moved `tools` down from the default “inverted triangle” to below where any CSS should be used. If you’re requiring logic of your CSS you’re gonna have a bad time in my experience. For example, the following codepen illustrates an instance where JS based styling tools would have saved me significant time and CSS bloat.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fmikeycodes%2Fembed%2Fpreview%2FgpGqJL%3Fheight%3D600%26amp%3Bslug-hash%3DgpGqJL%26amp%3Bdefault-tabs%3Dcss%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fmikeycodes%2Ffull%2FgpGqJL&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F217628.gpGqJL.small.9ce87243-6d64-4369-814e-3c96a5a83eea.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/31bc9fc90628eb0ac76a70d5aade0684/href">https://medium.com/media/31bc9fc90628eb0ac76a70d5aade0684/href</a></iframe><p>Granted, my real job doesn’t require many CSS Pokemon from me, so much of the time I can get by with simple styling `tools` that feel much better in JS land.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc78690989043f7d7dc024492738b7f0/href">https://medium.com/media/cc78690989043f7d7dc024492738b7f0/href</a></iframe><h4>Objects</h4><ul><li>OOCSS.</li><li>Design patterns.</li><li>Layout.</li><li>No cosmetics.</li><li>Agnostically named (e.g. list, block, media).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uZr6618PSFD5tQpLdQ3kPg.png" /></figure><p>I find that when I’m styling new features I have two distinct mindsets:</p><ol><li>Ok let’s get the layout / UI structure to spec.</li><li>Ok let’s get the cosmetics (color, font-size, border, transition, pointer, etc.) up to spec.</li></ol><p>After taking note of that enough times, I’ve come to believe structural styling and cosmetic styling are two different beasts. You do structural styling long enough and you’ll notice that they tend to fall into common patterns. This observation is kind of what led to the birth of OOCSS. The famous case study is how <a href="http://www.stubbornella.org/content/2010/06/25/the-media-object-saves-hundreds-of-lines-of-code/">The Media Object Save[d] Hundreds Of Lines Of Code</a> at Facebook. You can read the case study for more details (it’s short), but the basic idea is that you can extract the styling for rendering an image to the left of an undefined length of content to be reused.</p><p>Let’s see how we could use a Media `object` component to help us to render this `PokemonListing` component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*otukMK81p0Wq6SfcTx3aNA.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e4adb0bc062c90f86810a600d447a3d7/href">https://medium.com/media/e4adb0bc062c90f86810a600d447a3d7/href</a></iframe><h4>Components</h4><ul><li>Designed pieces of UI</li><li>Aphrodite’s bread &amp; butter</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IVu0ReIWjPH5YWiClDq6UQ.png" /></figure><p>The `components` layer is the one layer that will be truly unique across applications and is where I spend the majority of my styling time. Many of these other layers can potentially be `git cloned`when starting a new project or `npm installed` on demand, but the burden of a component’s existence will largely remain on you. Aphrodite is almost my exclusive go-to when styling components.</p><p>I also like to classify my components using <a href="https://twitter.com/brad_frost">Brad Frost’s</a> <a href="http://bradfrost.com/blog/post/atomic-web-design/">Atomic Design</a> which borrows from chemistry to describe an interface’s ability to be broken down into fundamental building blocks. `Button,` and `Input` <em>atoms</em> bond together to form a `Search` <em>molecule. </em>Pair that `Search` <em>molecule</em> with a `NavBar` <em>molecule </em>and we got ourselves a `Header`<em> organism. </em>Keep this organism thing up and we got a view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7rsRanmVjRh68Zg4BVGSmg.jpeg" /><figcaption>Atomic Design</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/61f01d050e12d16addbd610b5a41180d/href">https://medium.com/media/61f01d050e12d16addbd610b5a41180d/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f1d57a51a118dc16e58700d40ffb188a/href">https://medium.com/media/f1d57a51a118dc16e58700d40ffb188a/href</a></iframe><p>The further classification helps my team and I to take time to think more critically about the design of our components and ask: “How does this fit into the larger design system? Can this feature be broken down further into reusable atomic parts?”</p><p>Some of you may find the further classification of components to be overkill and to you I say right on 👍. Do what feels right to you and works for you and your team.</p><h4>Trumps</h4><ul><li>Helpers, utilities</li><li>Component lego blocks</li><li>Styling applied to singular elements</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AkNVl17wecsNsjdUK3Kgwg.png" /></figure><p>The `Trumps`layer may be better renamed to something along the lines of `Utility Atom` because it no longer is required to serve the purpose it use to. You see, the name was appropriate before because a `trump` style used fear and bullying via `!important` to apply the style it wanted with egotistical inconsideration of the lower-specificity styles’ wishes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d7d3cd534a4aa1874b7f175a3190cd5/href">https://medium.com/media/6d7d3cd534a4aa1874b7f175a3190cd5/href</a></iframe><p>Specificity Wars are no longer a thing with CSS-in-JS so the need to “Trump” or override styles is also no longer a thing.</p><p>What is nifty from the example above though is the ability quickly and conveniently use `pt` to apply top padding. The `Trumps` layer is one of my favorites for this reason. Let’s see how we can apply this principle with with CSS-in-JS using the Search <em>molecule</em> example from the `components` section.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/61d7d9c172e56c6670789d75407ed641/href">https://medium.com/media/61d7d9c172e56c6670789d75407ed641/href</a></iframe><p>This layer is where `inline-styles` really shine as seen in a naive implementation of `react-txt`:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69d5b373831f76c59e2b47ced245694b/href">https://medium.com/media/69d5b373831f76c59e2b47ced245694b/href</a></iframe><h3>Conclusion</h3><h4>Suggestions or feedback?</h4><p>The original motivation of this post was for it to serve as a living document to onboard new developers to our approach to application styling. While the scope creeped a bit, I intend it to remain a living document that incorporates new learnings and progression. I fully expect much of that learning to come from you. Leave a comment or hit me up on the <a href="https://twitter.com/TranscendMikey">twitters</a>.</p><h4>Know someone this could help?</h4><p>I hope my learning journey will provide value to yours and stimulate ideas for how to up your styling game. If you found this helpful, using your influence to pass it on will be appreciated by more than just myself! Leave a recommend, share on Slack, or share on Twitter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=632cfa9c70d6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/maintainable-react-apps/journey-to-enjoyable-maintainable-styling-with-react-itcss-and-css-in-js-632cfa9c70d6">Journey to Enjoyable, Maintainable Styling with React, ITCSS, and CSS-in-JS</a> was originally published in <a href="https://medium.com/maintainable-react-apps">Maintainable React Apps</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Apps: Approaching Organization / Structure / Architecture]]></title>
            <link>https://medium.com/maintainable-react-apps/react-apps-approaching-organization-structure-architecture-49a281bd97eb?source=rss-e0f2e67bba64------2</link>
            <guid isPermaLink="false">https://medium.com/p/49a281bd97eb</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Mikey]]></dc:creator>
            <pubDate>Wed, 08 Jun 2016 18:03:34 GMT</pubDate>
            <atom:updated>2016-06-08T18:14:05.889Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9A6-_poKvx5BFFyfeOFPfw.jpeg" /></figure><h4>Folder Structure</h4><p>With some evolution, we’ve taken cues from <a href="https://twitter.com/ryanflorence">Ryan Florence</a>’s approach to <a href="https://gist.github.com/ryanflorence/daafb1e3cb8ad740b346">folder structure</a>. The <strong>2</strong> basic ideas at work here are:</p><p><strong>1. File structure maps to routing</strong></p><p>Given these routes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*jK_SqvemAsWvtxrgmTJM0w.png" /><figcaption>example routes</figcaption></figure><p>We have this folder structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*WFvFmRkUIbep6zcnNek6nA.png" /><figcaption>example folder structure</figcaption></figure><p><strong>2. There are “<em>generic” </em>folders and<em> “feature”</em> folders</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UUeZKge8a-2jvXweUWtq9A.png" /><figcaption>sampling of feature vs general folders</figcaption></figure><p>This is a pretty standard representation<strong> </strong>of the types of folders to be seen in an application and their relation to each other<strong>. </strong>The big key here is that<strong> many</strong> <em>generic</em> folders map <strong>to one</strong> <em>feature</em> folder. A quick explanation of each general folder and it’s relation to a feature folder may help to make this idea more concrete. These are in no way exhaustive examples of valid general folders:</p><p><strong>components</strong> -&gt; These are the other component parts a feature is composed of. For example, App may have Navigation and Footer components in addition to dynamic main content.</p><p><strong>shared</strong> -&gt; Reusable component parts that get used across multiple views of an application find their home here. More detail on these later.</p><p><strong>state</strong> -&gt; state management related code goes here. In the case of redux, you’ll find action and reducer code here. State used across multiple views gets organized with root App component. If state management is unique to a particular view, it gets organized with that particular view.</p><p><strong>style</strong> -&gt; styling for associated component. The style directory for App holds global styles and settings. Generally for other views and components a single `style.css` file will suffice.</p><p><strong>config.*</strong> -&gt; Global app configuration related code. For example, config.routes is where the route registration discussed above can be found. These directories are name-spaced in an effort to keep the root of the app flat. General config folders are also appropriate with views and other smaller components requiring configuration.</p><p><strong>utils.*</strong> -&gt; Global utility / helper functions. For example, utils.rendering could contain methods such as `capitalize` which simply capitalizes strings. This may be a helpful utility across multiple components. General utility folders are also appropriate with views and smaller components unique to them.</p><h4>Feature &gt; Function</h4><p>Every thing is <strong>feature-centric </strong>and is therefore organized by feature rather than function. To get a better understanding of what this means, let’s contrast it with an app organized by function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zQg6be5mXgWEsUXyoZhdvw.png" /></figure><h4>Atomic Development</h4><p>Being fiercely feature-centric is heavily influenced by the concept of <a href="https://vimeo.com/67476280">Atomic Design</a> as championed by <a href="https://twitter.com/brad_frost">Brad Frost</a>. Atomic design is a “methodology for creating design systems.” Though simple, the concept is a powerful one to grasp. It is encouraged to read Brad Frost’s <a href="http://bradfrost.com/blog/post/atomic-web-design/">post</a> on the matter, but the following illustrates the idea well:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m2fb_YCpY3WUJxKNUjLPdA.png" /><figcaption>This illustration communicates the basic idea of atomic development nicely. Instead of thinking in terms of pages, we do so by it’s atomic parts.</figcaption></figure><p>With atomic development, a button <strong>atom</strong> + an input <strong>atom</strong> + a label <strong>atom</strong> = a nice search field <strong>molecule</strong> to pair nicely with a navigation links <strong>molecule</strong> to make up the header <strong>organism</strong> sitting at the top of a home page.</p><p>Thinking about an application in terms of atoms, molecules, and organisms helps promote a more thoughtful, purposeful mindset when developing components, ultimately leading to more reusability. This reason, along with the ability to quickly locate and understand a components utility, has led to the practice of name-spacing each component with its corresponding type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CGHdMesR7vMJjXNsWMFy4g.png" /><figcaption>An example shared directory with 5 different component types</figcaption></figure><p>Notice 2 additional `types` of components that we have found distinct utility apart from the relative size utility derived from our chemistry based components.</p><p><strong>hoc </strong>-&gt;<strong> h</strong>igher <strong>o</strong>rder <strong>c</strong>omponent -&gt; “a function that takes an existing component and returns another component that wraps it.” See an example introduced by <a href="https://twitter.com/sebmarkbage">Sebastian Markbåge</a> <a href="https://gist.github.com/sebmarkbage/ef0bf1f338a7182b6775">here</a> and the popular medium article it inspired by <a href="https://twitter.com/dan_abramov">Dan Abramov</a> <a href="https://medium.com/@dan_abramov/mixins-are-dead-long-live-higher-order-components-94a0d2f9e750">here</a>.</p><p><strong>object</strong> -&gt; objects deal strictly with structure and layout. They should be pretty well style agnostic. The concept is borrowed from the <a href="https://github.com/inuitcss?utf8=%E2%9C%93&amp;query=objects">inuitcss</a> framework by <a href="https://twitter.com/csswizardry">Harry Roberts</a>. For example, obj.Flexbox is no more than the css flexbox api adapted to be utilized via react component and deals strictly with layout.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*clWPsbM30Mtovur6Wpf6fA.png" /><figcaption>atm.Btn directory contains all relevant files</figcaption></figure><p>The other potentially curious thing we want to highlight from the above screenshot is that each component directory should contain every file relevant to it. One idea here is the ability to add or remove a single component directory to add or remove it from the application instead of hunting down different files. This is a continuation of the feature-centric approach.</p><p>This practice was inspired by and liberally borrowed from <a href="https://twitter.com/necolas">Nicolas Gallagher</a> of Twitter who revealed their modular approach to applications at dotcss in November 2014. It is worthwhile to <a href="http://www.thedotpost.com/2014/11/nicolas-gallagher-thinking-beyond-scalable-css">watch his presentation</a> to gain deeper insight into the wisdom behind the approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O2gLbq63kgz4jBwkQtPvPw.png" /><figcaption>Example from Nicolas Gallagher of how they organize components at Twitter</figcaption></figure><h4>Other guiding principles</h4><p>Lastly, it is worth noting some general guiding principles that can be seen at work here, and should be considered when making organizational decisions. Let as examine the <strong>LIFT</strong> principle preached by <a href="https://twitter.com/John_Papa">John Papa</a>:</p><p><strong>L</strong> — locating code is easy</p><p><strong>I</strong> — identify code at a glance</p><p><strong>F</strong> — flat structure as long as we can</p><p><strong>T </strong>— try to stay DRY</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49a281bd97eb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/maintainable-react-apps/react-apps-approaching-organization-structure-architecture-49a281bd97eb">React Apps: Approaching Organization / Structure / Architecture</a> was originally published in <a href="https://medium.com/maintainable-react-apps">Maintainable React Apps</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Surround yourself with the best in the Twroom]]></title>
            <link>https://transcendmikey.medium.com/surround-yourself-with-the-best-in-the-twroom-4945cbc5c82e?source=rss-e0f2e67bba64------2</link>
            <guid isPermaLink="false">https://medium.com/p/4945cbc5c82e</guid>
            <category><![CDATA[education]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Mikey]]></dc:creator>
            <pubDate>Thu, 31 Dec 2015 07:29:46 GMT</pubDate>
            <atom:updated>2015-12-31T07:45:50.278Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pTEHnF73KxMVYqcvA4jS3w.jpeg" /></figure><p>I speak with a <strong>lot</strong> of people looking to pick up code these days. Common motivations include the siren of large salaries and the plethora of job opportunities. To those motivated primarily to become <em>master of the craft </em>not already in the know, here is one of my strongest practices for break-neck pace learning.</p><h4>Be surrounded with the best in the Twroom</h4><p>There are two things you need to be convinced of here:</p><ol><li>We tend to rise or fall to the standard of those around us.</li><li>Twitter is a means to put the best people around you.</li></ol><p>I won’t spend much time trying to convince you of number one (I hope life experience has done that for you already), but as a thought exercise, consider the following:</p><ul><li>What would be the impact on a 5th grader’s learning after a year in a 6th grade classroom vs. that of a 4th?</li><li>What would be the average mile time for runners after 6 months if they trained with people running 6-minute miles vs. those running 8-minute miles?</li></ul><p>For me, almost every category of life can be positively or negatively influenced by those whom I choose to surround myself. When it comes to code, there are few things that light a fire out of complacency quite like seeing others push the envelope in what can be done when developing applications.</p><p>A common approach to surrounding oneself with the best is to work for a company to learn and to be mentored by smart engineers. I think this is a great<em> ideal</em>. I also think that finding a position at a company that <strong>1.)</strong> has these brilliant minds, <strong>2.)</strong> leaves them open for mentoring and <strong>3.)</strong> allows opportunity for consistent, meaningful work is a far more difficult task than one would hope. In addition, the most talented human in that company is only one citizen in the global tech community.</p><p>While not mutually exclusive, Twitter is only a sign-up away and can serve as a portal to some of the smartest humans building applications. Period.</p><h4>Twitter the tool, not just the network</h4><p>For the twitter uninitiated, a paradigm shift may need to take place.</p><p>Twitter was originally pitched to me (ironically in Austin, the home of its famous launch) as a place where one could send texts that the whole world could read. I balked at the concept and determined to take a hard pass.</p><p>Four years later, I was again in Austin attending SXSW where I discovered Twitter was almost exclusively the go-to networking and communication tool. After spending an inordinate amount of time choosing a handle, and the novelty of seeing what Taylor Swift had to say about life wore off, my perception of Twitter quickly shifted <em>from social network to that of a tool</em>.</p><p>With this change in perception, I began treating Twitter as a library with books of living knowledge just waiting to be checked out. All of a sudden I had access to a stream of thoughts, opinions, and resources from the most talented and prolific people in the industry — an industry that embraces Twitter as a medium for exchanging grey matter.</p><h4>The Twitter advantage</h4><p>The benefits I experience from leveraging Twitter boil down to preserving more of my most precious resource: time. The following are a subset of ways it can do the same for you.</p><ol><li><strong>Twitter is your personal tech bouncer</strong>. Among the most common lamentations from individuals building for the web is how fast everything moves and the increasing number of new things to learn. I’ve found a powerful key to learning is aggressively focusing time on the most valuable and enduring trends. Twitter is a fantastic filter and vetting process for new tech. Typically, the best and most worthwhile tech bubbles up here.</li><li><strong>Twitter gives you vision</strong>. Like your proximity from a spider, you are probably no more than 10 feet at any given moment from a person who changed their major in college at least twice. What’s more that person is likely working in a field largely unrelated to the degree they settled upon. How much more effective could their college years have been had they a clear direction on the type of career they wanted to end up in? How much more satisfying could their current position be? Congrats on deciding you want to master development! Where do you want to be with it in 10 years? Twitter has members of the industry that are already down that timeline. Following them on Twitter is like virtual job shadowing.</li><li><strong>Twitter is your learning resource concierge. </strong>The influx of people eager to learn to code has brought with it <em>a lot</em> of noise to the online learning space.<strong> </strong>There are as many people trying to teach you a particular technology as there are different technologies, and as with most things, not all are created equal. Some simply aren’t very effective at teaching, while others can be rife with anti-patterns. Again, Twitter can be leveraged here as a filter. See what material the authors and active communities of a technology put out and recommend. In addition, you can catch the pearls of wisdom and consume spontaneous discussions that never crystalized into a formal blog post. Also, get this, you can send your questions directly to the people with answers and you’ll be amazed at the response rate you’ll get.</li></ol><h4>So what’s your handle going to be?</h4><p>I’m confident much can be added (and better than I have/can) by way of benefits and how to leverage Twitter as a learning tool. My goal is to have convinced you to start composing your personal Twitter learning stream and begin experiencing the benefits yourself.</p><p>So who should you start following? Well that depends very much and what you’d like to learn! Let me know <a href="https://twitter.com/TranscendMikey">@TranscendMikey</a> and I’ll do my best to point you in the right direction.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4945cbc5c82e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React gotcha: dynamically rendering components with jsx]]></title>
            <link>https://transcendmikey.medium.com/react-gotcha-dynamically-rendering-components-with-jsx-b53fc07f63ca?source=rss-e0f2e67bba64------2</link>
            <guid isPermaLink="false">https://medium.com/p/b53fc07f63ca</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[jsx]]></category>
            <dc:creator><![CDATA[Mikey]]></dc:creator>
            <pubDate>Tue, 15 Sep 2015 18:22:33 GMT</pubDate>
            <atom:updated>2015-09-17T18:55:06.918Z</atom:updated>
            <content:encoded><![CDATA[<p>Some will discover with great sadness that the following will not work as they may expect:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd8f6e9aaee70432138a7f01b7b2673e/href">https://medium.com/media/fd8f6e9aaee70432138a7f01b7b2673e/href</a></iframe><p><strong><em>EDIT:</em></strong> The great thing about working in the open is you tap into more brains than your own. Thanks to feedback from <a href="https://twitter.com/justin_hewlett/status/644171366053187584">Justin</a> &amp; <a href="https://medium.com/@evanplus">Evan</a>, there is a far more sensible (albeit anti-climatic) reason and solution for the above not working than what I go on to detail.</p><blockquote>“…we decided on a convention: All JSX tags that start with a lower-case letter or contain a dash are treated as HTML.” — Sebastian Markbage</blockquote><p>Turns out the true gotcha here is not this <a href="https://facebook.github.io/react/docs/jsx-in-depth.html#html-tags-vs.-react-components">documented jsx convention</a>, but the tendency to name variables in this type of context starting with lower-case.</p><p>Read on for how I circumvented this convention in a couple other nifty ways :P. Or just capitalize anything you want to be rendered as a custom React element and use your screen real-estate for something better.</p><p>I discovered this when I wanted to use a <a href="http://addyosmani.com/resources/essentialjsdesignpatterns/book/#facadepatternjavascript">facade pattern</a> to provide a simple api for rendering job information in different forms using a Job component that received two props:</p><ol><li>the job data</li><li>how to render the job</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c5d3cad04589a1f31a05cfedc9a5356c/href">https://medium.com/media/c5d3cad04589a1f31a05cfedc9a5356c/href</a></iframe><p>A naive first approach at this Job facade looked like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2310cb984ad02af87069824600a22e2b/href">https://medium.com/media/2310cb984ad02af87069824600a22e2b/href</a></iframe><p>After looking into it I discovered accessing the property of an object <em>does</em> work. This seems to <strong>force jsx to recognize it as a variable</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/85c1df753681e105bc064056ee8bed32/href">https://medium.com/media/85c1df753681e105bc064056ee8bed32/href</a></iframe><p>Playing around a bit more yielded the discovery of a quirk of jsx. Variables beginning with non-alphabetic characters force jsx to treat it as a variable and use the variable’s value rather than using the literal variable name.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0b677f124fb6091d4d7dae27c3bdec9/href">https://medium.com/media/c0b677f124fb6091d4d7dae27c3bdec9/href</a></iframe><p>Here is a look at what is happening when the jsx comes out the other end as plain ol’ js:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4cff584a1ba81d5bdb04045417f33b16/href">https://medium.com/media/4cff584a1ba81d5bdb04045417f33b16/href</a></iframe><p>Here is the final implementation:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/760c545a76f31fb4b81be4e576d39cdd/href">https://medium.com/media/760c545a76f31fb4b81be4e576d39cdd/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b53fc07f63ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wormholes & Wading into the waters of the new JavaScript: ES6]]></title>
            <link>https://transcendmikey.medium.com/wading-into-the-waters-of-the-new-javascript-es6-ca39a0ae7515?source=rss-e0f2e67bba64------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca39a0ae7515</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[es6]]></category>
            <dc:creator><![CDATA[Mikey]]></dc:creator>
            <pubDate>Fri, 10 Apr 2015 13:11:07 GMT</pubDate>
            <atom:updated>2015-04-10T13:13:16.682Z</atom:updated>
            <content:encoded><![CDATA[<h2>Wormholes &amp; Wading into the Waters of the new JavaScript: ES6</h2><p>As a Masochist, I actively follow many of the “thought leaders” in the JavaScript community via Twitter. This is something I highly recommend if you enjoy the constant anxiety that comes from the feeling of drowning in an ocean of things that are beyond you.</p><p>One of these ocean droplets for me had been ES6 (<strong>E</strong>CMA<strong>S</strong>cript, a.k.a. JavaScript), or “Harmony,” or ES2015, or whatever people settle on referring to it as (See?! People haven’t even decided what to call it yet!). ES6 is “the upcoming sixth major release of the ECMAScript [JavaScript] language specification (<a href="http://globaldev.co.uk/2013/09/es6-part-1/">Source</a>).” In other words, it’s a list of language features that don’t *presently* exist in JavaScript, but will.</p><p>So why bother myself with something that isn’t *official* yet when I have plenty of other relevant things to learn? Well that was my strategy exactly: worry about it later. I mean, even when it gets *officially* approved by the <a href="http://www.ecma-international.org/memento/TC39.htm">TC39 committee</a> it would take who knows how long based on past track records for it to be supported by all the major browsers my users are on.</p><h4>Wormholes</h4><p>But then a few months ago, I must have been feeling too confident in my developing JavaScript chops, because I noticed an increasing uptick in the number of people I saw not just talking about ES6, but actually <em>using</em> it in development #wut. My mind was blown and <a href="http://ryanscowles.com/2013/04/web-developers-and-the-impostor-syndrome/">imposter syndrome</a> checked in to say hello. Which wormhole did they just crawl out of that allowed them to use JavaScript features <em>that didn’t even exist</em> <em>yet</em>???</p><p>It was in the midst of a switch from an Angular + Grunt workflow to a React + Webpack one (more things *once* beyond my comprehension) that I discovered a brand of one of these wormholes by the name of Babel (ironically they also recently experienced an <a href="https://babeljs.io/blog/2015/02/15/not-born-to-die/">identity crisis</a>). Babel can explain what <a href="https://babeljs.io/">Babel</a> does better than I, but essentially you write JavaScript using ES6 features and syntax that Babel will then compile for you into ES5 JavaScript my user’s browsers know and support. With tools like <a href="https://github.com/petehunt/webpack-howto">Webpack</a> this process is automated with every save so I don’t even have to think about it. I write in ES6 and it just <em>works</em>.</p><p>Here are a few of the features I’ve been deriving simple pleasures from while developing for production:</p><h4>String Templates</h4><p>String templates have become a fast favorite convenience. Instead of having to use string concatenation for dynamic strings, you can now use variables directly:</p><pre>var firstName = &#39;Astro&#39;;<br>var lastName = &#39;Panda&#39;;</pre><pre>/**<br> * ES5<br> */<br>var message = &#39;Howdy &#39; + firstName + lastName + &#39;!&#39;;</pre><pre>/**<br> * ES6<br> * 1. Note we must use ``, not <br> * &#39;&#39; or &quot;&quot;<br> * 2. Variables are designated <br> * within ${}<br> */<br>var message = `Howdy ${firstName} ${lastName}!`;</pre><pre>//Howdy Astro Panda!</pre><h4>Imports &amp; Exports: native CommonJS</h4><p><a href="https://egghead.io/lessons/nodejs-what-are-commonjs-modules">CommonJS</a> is a method for including javascript modules (other js files) as declared dependencies without global namespace pollution. It’s a incredibly useful practice for creating modular &amp; scalable codebases. This was not something that was natively available to the language though and required third party libraries and tooling. Javascript will natively support this functionality and I’ve been enjoying its syntax.</p><pre>/**<br> * CommonJS syntax<br> */</pre><pre>//importing<br>var Router = require(&#39;react-router&#39;);</pre><pre>//exporting<br>module.exports = myModule;<br></pre><pre>/**<br> * Native syntax<br> */</pre><pre>//importing<br>import Router from &#39;react-router&#39;;</pre><pre>//exporting<br>export default myModule;</pre><h4>Destructuring Assignment</h4><p>This shorthand allows you to bind a set of variables to a corresponding set of values, where normally you are only able to bind a value to a single variable. This has all sorts of applications, but I’ve found it most convenient for extracting multiple properties from an object like so:</p><pre>/**<br> * ES5<br> * react-router is an object <br> * that has many properties.<br> * If I wanted a reference <br> * to several of them I would be <br> * required to do so like this:<br> */</pre><pre>import Router from &#39;react-router;<br>var Route = Router.Route;<br>var RouteHandler = Router.RouteHandler;<br>var Link = Router.Link</pre><pre>/**<br> * ES6<br> * I can get the same 3 references <br> * with this syntax:<br> */</pre><pre>import { Route, RouteHandler, Link } from &#39;react-router&#39;; //cool</pre><h4>Object Literal Property Shorthand</h4><p>This is just another simple pleasure that introduces some syntactic sugar to creating object literals. Here are a couple shorthand examples I’ve been taking advantage of:</p><pre>/**<br> * ES5<br> * How to declare a function as <br> * an object property<br> */<br>var cat = {<br>  meow: function() { console.log(&#39;meow&#39;); }<br>}</pre><pre>/**<br> * ES6<br> * Drop the &#39;function&#39; keyword<br> */<br>var cat = {<br>  meow() { console.log(&#39;meow&#39;); }<br>}</pre><pre><br>/**<br> * Sometimes I like to leverage <br> * function hoisting to<br> * have the api of a given module <br> * to be clean, readable,<br> * and easy to find at the top of <br> * my file. ES6 makes it<br> * even cleaner:<br> */</pre><pre>//ES5<br>var es5Cat = {<br>  meow: meow,<br>  purr: purr<br>}</pre><pre>//ES6<br>var es6Cat = {<br>  meow,<br>  purr<br>};</pre><pre>ES5Cat.meow(); //meow</pre><pre>//works the same<br>ES6Cat.purr(); //purr</pre><pre>function meow() { console.log(&#39;meow&#39;); }<br>function purr() { console.log(&#39;purr&#39;); }</pre><h3>Conclusion</h3><p>There are far more applications to these particular features as well as handfuls more of brand new ones to explore. To learn them there is far better content than I can provide. May aim was to introduce some simple ways using ES6 was helping to make my code cleaner, more convenient and readable, and ultimately give one courage to step into the wormhole to give this a try.</p><p>Have more questions? Some ES6 tricks to share? Hit me up on <a href="https://twitter.com/TranscendMikey">twitter</a>!</p><p>Got 10 minutes? Check out some of the resources that helped me.</p><h4>Resources:</h4><p><a href="https://egghead.io/technologies/es6">Egghead.io ECMAScript 6 lessons</a></p><p><a href="https://egghead.io/lessons/angularjs-angular-with-webpack-es6-with-babeljs">Setting up BabelJS with Webpack</a></p><p><a href="https://babeljs.io/docs/learn-es6/">Detailed overview of ECMAScript 6 features</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca39a0ae7515" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>