<?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 Ryan Johnson on Medium]]></title>
        <description><![CDATA[Stories by Ryan Johnson on Medium]]></description>
        <link>https://medium.com/@ryandrewjohnson?source=rss-3e1c2751bed------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*uF2Gx61XOcdZ0mMdMndK_A.jpeg</url>
            <title>Stories by Ryan Johnson on Medium</title>
            <link>https://medium.com/@ryandrewjohnson?source=rss-3e1c2751bed------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 13:19:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ryandrewjohnson/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[Making friends at work as a freelancer]]></title>
            <link>https://medium.com/@ryandrewjohnson/how-do-you-make-work-friends-as-a-freelancer-270355369368?source=rss-3e1c2751bed------2</link>
            <guid isPermaLink="false">https://medium.com/p/270355369368</guid>
            <category><![CDATA[freelancing]]></category>
            <category><![CDATA[freelance]]></category>
            <category><![CDATA[friendship]]></category>
            <category><![CDATA[contractors]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Ryan Johnson]]></dc:creator>
            <pubDate>Wed, 16 Jan 2019 04:14:30 GMT</pubDate>
            <atom:updated>2019-01-16T15:56:22.949Z</atom:updated>
            <content:encoded><![CDATA[<h4>Sharing my personal experience as a freelancer, and the challenges I’ve faced with building friendships at work.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*04xyww3MbS6JoM15_RWC8A.jpeg" /><figcaption>Me every time I hear he’s “just a contractor” at work.</figcaption></figure><p>Hi there, I’m Ryan; a freelance, self-employed web developer — which ultimately means I’m a company of one.</p><p>I recently stumbled upon the following tweet from a fellow freelancer that asked<strong> — How do you make long-term friends as freelancer?</strong></p><h3>James Good 🏔️🇬🇧 on Twitter</h3><p>How do you make long-term friends as a freelancer, that aren&#39;t the friends you knew in school? It&#39;s not something I discuss often, but 2018 was a lonely year, and it&#39;s one of my commitments to not let 2019 go the same way. Any advice is appreciated!</p><p>This really hit home for me, as I can 100% relate with James. I’ve found the continuous job churn as a freelancer tends to create barriers when making friends at work. During my six years of self-employment I’ve struggled to have any work friendships endure past the contract term. While in comparison, to this day I’m still friends with team members from one of my first full-time jobs.</p><p>As a freelancer you tend to get used to constant change — it’s one of the things that I both love and hate about being on contract. The constant change keeps me on my toes, and ensures that I’m always being presented with new challenges. But on the flip side that constant change also means I’m continually jumping from job to job.</p><p>For most people starting a new job, while exciting, can be equally stressful. You have to continually walk into an office where everything is new — the people, the processes, the food, your desk, the commute, and everything else that comes along with a fresh start. Now imagine doing that over, and over again — that’s the life of a freelancer!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*i-4tGk8Xi1q_RD1w64Xs0A.jpeg" /><figcaption>So what company is this again?</figcaption></figure><p><strong>Is this all to blame on freelancing?</strong> Certainly not! This would be ignoring all the complexities that go into making lasting friendships. For example that full-time job I mentioned was back when I was in my twenties, and free time was in abundance, and making new friends seemed easier. Where as now I’m in my thirties, free time is sparse, and my number one priority is my family.</p><p>All this aside I can’t deny there are certain ingredients with the freelance life that have contributed to my shrunken circle of work friends. It’s well known that <strong>proximity</strong>, and <strong>repeated unplanned interactions</strong> are two key conditions when it comes to making new friends. Even when contracts are on-site, and I get ample exposure to these conditions, I still find it difficult to make connections that endure past the work term. Here’s a few of the challenges I’ve faced while working on contract:</p><ul><li>As a contractor your time at a company is limited, and because your co-workers know this I find they will sometimes be more hesitant in taking the time to get to know you. To be honest this goes both ways, and It’s something I’m working on from my end.</li><li>Everyone loves to complain about their job to fellow co-workers. I feel like it’s a rite of passage when you’re full-time. If you’re not full-time you shouldn’t be complaining! This is not your company after all! It usually takes a while, or sometimes not at all, before a team confides in me enough to get involved in these company rants.</li><li>There are just some conversations you’ll always be on the outs with in my experience. For example benefits, bonuses, vacation days, promotions, and end of year reviews are just some of the conversation topics that are more difficult to be welcomed into. Even when welcomed, I’ve found it’s not the same as you’re not personally impacted by the outcome of these topics, while your co-worker usually is.</li></ul><p>I can only guess at where some of these social situations stem from, but I think it comes from a “we’re in this together” feeling that you get when you’re working with a full-time coworkers. Where as a contractor you have to jump through a few more hoops before being welcomed into the group.</p><p>In addition to the above I’ve also encountered something I can only describe as the <strong>“just a contractor” </strong>feeling. This feeling usually occurs when the fact that I’m not a permanent employee becomes very evident. This might be as simple as being left out of work related events, and conversations, or excluded from an “employees” only meeting.</p><p>One of my favourite <strong>“just a contractor”</strong> moments had to be when a company I was working for failed to inform me that they were moving offices over the weekend. So when I showed up Monday the office was empty, and I eventually found out they’d moved across the city!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*R24C8UagCTS2IqldcGeC0w.gif" /><figcaption>Oh! You didn’t get the memo about the office move?</figcaption></figure><p>I should mention that I’m not advocating for contractors to be entitled to all the same perks that full-time employees rightfully enjoy. These are merely examples of social challenges I’ve encountered as a freelancer over the years. Thankfully that last scenario is the rarity, and the majority of the companies have done their best to make me feel like part of the team. By no coincidence, these are usually the places where people are most welcoming, and as a result are the most enjoyable to work with.</p><p><strong>So why share all this? </strong>Firstly I’m hoping to open a dialogue with others, and have them share their experiences as well. Just like James motivated me to share my story with his tweet I’m hoping I can do the same. Lastly, if you find yourself working with a freelancer on your team don’t be afraid to invite them out on the next coffee run — I’m sure they’d appreciate it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*CEz3o545anOnLGXaOIO3SQ.gif" /></figure><p>A small note for any of you thinking of making the jump to freelance. Please don’t take this as a negative take on the freelance life. <strong>I love my life as a freelancer</strong>, and I honestly have no regrets about quitting my full-time job way back in the summer of 2012. There will always be pros, and cons when it comes to any decision, but in the case of freelancing this has probably been my only major grievance.</p><p><strong>For more React, Redux, and JavaScript reading follow me on </strong><a href="https://medium.com/@ryandrewjohnson"><strong>Medium</strong></a><strong> or </strong><a href="https://twitter.com/ryandrewjohnson"><strong>Twitter</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=270355369368" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Celebrate the Holidays with The 12 Days of Reactmas]]></title>
            <link>https://medium.com/@ryandrewjohnson/celebrate-the-holidays-with-the-12-days-of-reactmas-63eb55fa363?source=rss-3e1c2751bed------2</link>
            <guid isPermaLink="false">https://medium.com/p/63eb55fa363</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Ryan Johnson]]></dc:creator>
            <pubDate>Fri, 14 Dec 2018 02:38:40 GMT</pubDate>
            <atom:updated>2018-12-21T14:43:46.361Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PKD7TN4Fb05-eLxYbOtDpQ.png" /></figure><h3>🎄The 12 Days of Reactmas 🎄</h3><h4>Tis the season of giving — so starting December 1st, I will be releasing 12 snack size React posts over the month of December! Each post will cover a topic like HOCs, renderProps, unit tests, and more!</h4><h3>🎄 Ryan Johnson 🎄 on Twitter</h3><p>Tis the season for giving - over the next month I&#39;ll be doing my damndest to post 12 snack size React posts covering various topics. Like RenderProps, HOCs, hooks, and much more. First one drops tomorrow 🎄#12DaysOfReactmas🎄</p><h3>🎄 Ryan Johnson 🎄 on Twitter</h3><p>A small preview for tomorrow - will have code demo of the &amp;lt;ScrollHelper /&amp;gt; component that was built for this nice lil scrolling Santa 🎅 #12DaysOfReactmas #reactjs #React https://t.co/bubtg4GjzL</p><h3>🎄 Ryan Johnson 🎄 on Twitter</h3><p>On the first day of Reactmas I give you a &amp;lt;ScrollHelper /&amp;gt; component using the render props pattern. Help Santa by scrolling him all the way to the North Pole! Tip: On mobile? Open Preview View in new window #12DaysOfReactmas #React #reactjs https://t.co/mp5z0PxEwi</p><h3>🎄 Ryan Johnson 🎄 on Twitter</h3><p>On the second day of Reactmas I give you &amp;lt;ResponsiveBackgroundImage /&amp;gt;. The srcSet attribute is great, but only works with image elements. With this component use srcSet with your #CSS background-images. #12DaysOfReactmas #reactjs https://t.co/OYxExiDmoL</p><h3>🎄 Ryan Johnson 🎄 on Twitter</h3><p>On the 3rd day of Reactmas I give you a configurable &amp;lt;ActivityMonitor /&amp;gt; component. Easily monitor events like click, mousemove, keypress, and then trigger state changes based on activity. #12DaysOfReactmas #reactjs #javascript #WebDeveloper #Rudolph https://t.co/wYX273oFSe</p><h3>🎄 Ryan Johnson 🎄 on Twitter</h3><p>On the 4th day of Reactmas I give you a demo leveraging &amp;lt;React.Fragment/&amp;gt;. Easily add a click blocker to a slide in navigation component, that can sit outside the bounding box of the component. #12DaysOfReactmas #javascript #reactjs https://t.co/GKJnwcTxhk</p><h3>🎄 Ryan Johnson 🎄 on Twitter</h3><p>On the 5th Day of Reactmas I&#39;m sick as a dog and have no time to create anything new. Instead I want to share with you my localization library for React that optionally works with Redux out of the box! #12DaysOfReactmas #reactjs #redux #javascript https://t.co/Xb1RqKMilb</p><h3>🎄 Ryan Johnson 🎄 on Twitter</h3><p>On the 6th Day of Reactmas I give you a &amp;lt;StoreProvider/&amp;gt; component. Use reducers, actions just like #redux, but built on React&#39;s Context API #12DaysOfReactmas #reactjs #redux https://t.co/viuPMiY1va</p><h3>🎄 Ryan Johnson 🎄 on Twitter</h3><p>On the 7th Day of Reactmas I give you a withStore HOC that works with &amp;lt;StoreProvider /&amp;gt; from Day 6. Easily access your store state, and dispatch actions from any component. #reactjs #redux #12DaysOfReactmas #javascript https://t.co/sD1oxgCPSo</p><h3>🎄 Ryan Johnson 🎄 on Twitter</h3><p>On the 8th Day of Reactmas I&#39;m releasing my React for Beginners course for FREE to 8 lucky people. Please use the link below or the coupon code REACTMAS. #12DaysOfReactmas #reactjs #javascript https://t.co/nhRtI6tvFR</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63eb55fa363" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I just published my first course for React]]></title>
            <link>https://medium.com/@ryandrewjohnson/i-just-published-my-first-course-for-react-4d2cd15ec107?source=rss-3e1c2751bed------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d2cd15ec107</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[teaching-and-learning]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Ryan Johnson]]></dc:creator>
            <pubDate>Mon, 26 Nov 2018 13:46:05 GMT</pubDate>
            <atom:updated>2018-11-26T13:46:05.001Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn React without all the distractions. This course will stick to the fundamentals, and guide you through the creation of your first app.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mqyyqg4t2TyMYWgtnPYoBw.png" /></figure><p>After months of writing, recording, and editing I have finally published my first online course — React for Beginners: Build and app, and learn the fundamentals.</p><p>The course is currently available on the following platforms:</p><figure><a href="https://www.udemy.com/share/100GaX/"><img alt="" src="https://cdn-images-1.medium.com/max/300/1*Y6u3wamjQFd6aniPvk_uFg.png" /></a></figure><figure><a href="https://skl.sh/2CssGg0"><img alt="" src="https://cdn-images-1.medium.com/max/300/1*gTkssZABFwId_dIDeaaq4w.png" /></a></figure><h3>About the Course</h3><p>A lot of React newcomers tend to get hung up on external dependencies like webpack, and redux. While tools like this are great they tend to add additional complexity when starting out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*uNigw2x3ZfbbG5jBCQlJxw.jpeg" /><figcaption>Learning React doesn’t mean you have to learn Redux.</figcaption></figure><p>In my lessons I will be avoiding all the distractions, and sticking to React fundamentals, and guiding you through the creation of your first app.</p><p>The course is split into three main categories <strong>Fundamentals</strong>, <strong>Building an app</strong>, and <strong>How React works</strong>.</p><p><strong>Fundamentals</strong> will cover things like Elements, Components, and JSX. After that in <strong>Building an app </strong>we’ll jump right into creating a fully functional Dad joke search engine. Finally in <strong>How it works</strong> will take a look under the hood and explore how React handles rendering updates to the DOM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*b9-WHUJ2NMj5Cwk6LP7bDQ.jpeg" /></figure><p>After taking this course, you’ll have a solid foundation in the fundamentals of React, and should be confident enough to move onto more advanced topics, which I hope to cover in future courses.</p><p>If you have enjoyed the course please help by spreading the word! Please feel free to send any questions or feedback related to the course my way.</p><p><a href="https://skl.sh/2CssGg0">React for Beginners on Skillshare</a></p><p><a href="https://www.udemy.com/share/100GaX/">React for Beginners on Udemy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d2cd15ec107" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Localize Redux 3.0]]></title>
            <link>https://medium.com/@ryandrewjohnson/react-localize-redux-3-0-47357510751e?source=rss-3e1c2751bed------2</link>
            <guid isPermaLink="false">https://medium.com/p/47357510751e</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[i18n]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[localization]]></category>
            <dc:creator><![CDATA[Ryan Johnson]]></dc:creator>
            <pubDate>Mon, 04 Jun 2018 02:02:52 GMT</pubDate>
            <atom:updated>2018-11-27T01:54:07.651Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h9VKybzPrF2FRrOwcv6KnA.png" /></figure><h4>Want to learn React? Check out my new course React for Beginners: Build and app, and learn the fundamentals.</h4><figure><a href="https://www.udemy.com/share/100GaX/"><img alt="" src="https://cdn-images-1.medium.com/max/700/1*wyLGOJ_w_ug5xrUshZAQgw.png" /></a></figure><figure><a href="https://skl.sh/2CssGg0"><img alt="" src="https://cdn-images-1.medium.com/max/700/1*-nT6jBnsk1Xco9wX_7CL2A.png" /></a></figure><h4>I’m happy to announce the latest release of react-localize-redux. New features, new docs, new logo, and now works without Redux by default.</h4><blockquote><strong><em>Want to get straight to it? </em></strong><a href="https://github.com/ryandrewjohnson/react-localize-redux">Github</a> /<a href="https://ryandrewjohnson.github.io/react-localize-redux-docs/"><strong>Official Docs</strong></a></blockquote><h4>No Redux, No problem!</h4><p>This latest release is built on <a href="https://reactjs.org/docs/context.html">React’s Context</a>, and will now work without <a href="https://redux.js.org/">Redux</a> by default. All you need to do is wrap your application in <a href="https://ryandrewjohnson.github.io/react-localize-redux-docs/#localizeprovider">LocalizeProvider</a> to get started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*jYDlR4ex1FvmEPy3iY5OBQ.png" /></figure><h4>We still ❤️ Redux</h4><p>Redux support hasn’t gone anywhere — It’s in the name after all! So your app is already using redux? No problem, as react-localize-redux supports Redux out of the box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*i43MxbUOSn0xu-aBlklM8A.png" /></figure><h4>Insert translations with &lt;Translate /&gt; component</h4><p>The <a href="https://ryandrewjohnson.github.io/react-localize-redux-docs/#translate-2">Translate</a> component is how you access your translations from your components, and it can be used in a variety of ways.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*rFfO-uU4YKccWfDgDN2FRQ.png" /></figure><h4>Include inline default translations</h4><p>With the <a href="https://ryandrewjohnson.github.io/react-localize-redux-docs/#translate-2">Translate</a> component you can include an inline translation for the default language by passing as children to the component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*ODHm_qTPjjZT1PcfgW0adg.png" /></figure><h4>Use withLocalize to consume LocalizeContext</h4><p>Under the hood react-localize-redux uses <a href="https://reactjs.org/docs/context.html#reactcreatecontext">React.createContext</a> to create<a href="https://ryandrewjohnson.github.io/react-localize-redux-docs/#localizecontext">LocalizeContext</a>, which holds the actions and properties needed to manage your translations. It would be tedious to explicitly wrap each component in LocalizeContext.Consumer, which is where the <a href="https://ryandrewjohnson.github.io/react-localize-redux-docs/#withlocalize">withLocalize</a> <a href="https://reactjs.org/docs/higher-order-components.html">higher-order-component</a> helps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*g8vxSNFlpU8enWajamlU0A.png" /></figure><h4>Manage missing translations</h4><p>By default any components with a missing translation will render a default missing translation message. This can be overridden by setting the onMissingTranslation initialize option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*ng0YPcTWMyp5hJzo8GZ8nQ.png" /></figure><p>You can also override this setting for a specific translation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*8OESGDL50no2G2NBq9AVyw.png" /></figure><h4>Want to learn more?</h4><p>Make sure to check out the <a href="https://ryandrewjohnson.github.io/react-localize-redux-docs/">official docs</a>, which includes full details on these additional features plus more.</p><ul><li><a href="https://ryandrewjohnson.github.io/react-localize-redux-docs/#dynamic-translations">Dynamic translations</a></li><li><a href="https://ryandrewjohnson.github.io/react-localize-redux-docs/#html-translations">HTML translations</a></li><li><a href="https://ryandrewjohnson.github.io/react-localize-redux-docs/#formatting-translations">Formatting translations</a></li><li><a href="https://ryandrewjohnson.github.io/react-localize-redux-docs/#can-i-use-react-native">Can I use Reactive Native?</a></li></ul><h4>More where this came from</h4><p>This story is published in <a href="http://blog.usejournal.com/">Noteworthy</a>, where thousands come every day to learn about the people &amp; ideas shaping the products we love.</p><p>Follow our publication to see more product &amp; design stories featured by the <a href="https://usejournal.com/?utm_source=usejournal.com&amp;utm_medium=blog&amp;utm_campaign=guest_post">Journal</a> team.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47357510751e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unit testing components using React’s new Context API]]></title>
            <link>https://medium.com/@ryandrewjohnson/unit-testing-components-using-reacts-new-context-api-4a5219f4b3fe?source=rss-3e1c2751bed------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a5219f4b3fe</guid>
            <category><![CDATA[enzyme]]></category>
            <category><![CDATA[jest]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Ryan Johnson]]></dc:creator>
            <pubDate>Mon, 16 Apr 2018 15:39:28 GMT</pubDate>
            <atom:updated>2018-11-27T01:51:28.218Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*T9UWrZcPIOKOxTrrPAFP4w.jpeg" /></figure><h4>Want to learn React? Check out my new course React for Beginners: Build and app, and learn the fundamentals.</h4><figure><a href="https://www.udemy.com/share/100GaX/"><img alt="" src="https://cdn-images-1.medium.com/max/700/1*wyLGOJ_w_ug5xrUshZAQgw.png" /></a></figure><figure><a href="https://skl.sh/2CssGg0"><img alt="" src="https://cdn-images-1.medium.com/max/700/1*-nT6jBnsk1Xco9wX_7CL2A.png" /></a></figure><p>With the latest release of React the <a href="https://reactjs.org/docs/context.html">Context</a> API has finally become a first class citizen. I have just started working with it, and so far it’s been a breeze to work with, but with one small caveat— unit tests.</p><p>Beyond an <a href="https://github.com/airbnb/enzyme/issues/1509">official PR in enyzme</a> to add support for the new Context API, which at the time of this writing is still in development, I haven’t been able to find many good examples of unit testing components using context. In the meantime I’ve found the following solution worked pretty well for my scenarios.</p><blockquote>NOTE: I’m using <a href="https://facebook.github.io/jest/">jest</a> and <a href="https://github.com/airbnb/enzyme">enzyme</a>, but I’m sure the mocking technique being used can be applied to other testing solutions. For full working example see <a href="https://github.com/ryandrewjohnson/react-localize-redux/blob/v3/tests/Translate.test.js">react-localize-redux v3 branch</a></blockquote><p>In this example I’m creating a new context namedLocalizeContext that will be responsible for passing localization info to any components that wish to consume it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c7b7e3c8953d586c849b14571ac77d5/href">https://medium.com/media/6c7b7e3c8953d586c849b14571ac77d5/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0cdc9564c4938a2f07dcbe79d7bfe46b/href">https://medium.com/media/0cdc9564c4938a2f07dcbe79d7bfe46b/href</a></iframe><p>Now let’s create a simple LanguageSelector component that consumes the LocalizeContext. By adding LocalizeContext.Consumer to our component we are able to retrieve languages and activeLanguage from LocalizeContext.Provider.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7ee3af12c24aca8a1134a502ca208d8/href">https://medium.com/media/f7ee3af12c24aca8a1134a502ca208d8/href</a></iframe><p>Now we have a component that renders a link for each supported language, and adds styling for the active language link. I want to add unit tests to the LanguageSelector component, but before doing that I need a way to handle the LocalizeContext.Consumer component in our tests.</p><p>For this we’re going to leverage jest’s awesome mocking capabilities — more specifically the <a href="https://facebook.github.io/jest/docs/en/jest-object.html#jestdomockmodulename-factory-options">jest.doMock</a> method. With this we can create a utility method that is passed the required context, and returns a version of LanguageSelector with a mocked consumer.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3fca4737cb9e4510edd6c117dd07ef5b/href">https://medium.com/media/3fca4737cb9e4510edd6c117dd07ef5b/href</a></iframe><p>That’s it! Now when we run each test we can pass in mock context data to drive the test. This was a very simple example, but you can also view a full working example at <a href="https://github.com/ryandrewjohnson/react-localize-redux/blob/v3/tests/Translate.test.js">react-localize-redux v3 branch</a>.</p><p><strong>For more React, Redux, and JavaScript reading follow me on </strong><a href="https://medium.com/@ryandrewjohnson"><strong>Medium</strong></a><strong> or </strong><a href="https://twitter.com/ryandrewjohnson"><strong>Twitter</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a5219f4b3fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Passing state between reducers in Redux]]></title>
            <link>https://itnext.io/passing-state-between-reducers-in-redux-318de6db06cd?source=rss-3e1c2751bed------2</link>
            <guid isPermaLink="false">https://medium.com/p/318de6db06cd</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Ryan Johnson]]></dc:creator>
            <pubDate>Tue, 27 Feb 2018 03:54:04 GMT</pubDate>
            <atom:updated>2018-11-27T01:55:31.268Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BpaqVMW2RjQAg9cFHcX1pw.png" /></figure><h4>Want to learn React? Check out my new course React for Beginners: Build and app, and learn the fundamentals.</h4><figure><a href="https://www.udemy.com/share/100GaX/"><img alt="" src="https://cdn-images-1.medium.com/max/700/1*wyLGOJ_w_ug5xrUshZAQgw.png" /></a></figure><figure><a href="https://skl.sh/2CssGg0"><img alt="" src="https://cdn-images-1.medium.com/max/700/1*-nT6jBnsk1Xco9wX_7CL2A.png" /></a></figure><p>Have you ever had a slice of state from one reducer that you needed access to in another reducer? If you’re using Redux’s <a href="https://redux.js.org/api-reference/combinereducers">combineReducers</a> out of the box then you may be stuck, or you could use <a href="https://github.com/redux-utilities/reduce-reducers">reduce-reducers</a>, but that may be overkill for your needs.</p><blockquote>Instead why not write your own combine reducers?</blockquote><p>It’s easy to forget that reducer’s are just a functions with the following format (previousState, action) =&gt; newState, and there’s no reason you can’t write your own version of combineReducers to handle this scenario. The following is a pattern I use to access state from different slices in my reducer.</p><p>For example if we were building an app that deals with localization we might have the following state shape:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/715895a04e7419cee93c6361e01ebb67/href">https://medium.com/media/715895a04e7419cee93c6361e01ebb67/href</a></iframe><p>In the above state languages is an array of languages the app supports, while translations is an object where each key’s value is an array with a translation for each supported language. If we were using combineReducers to assemble this state it would look something like this…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/536058960b3d91cfe80bde21b7e895e3/href">https://medium.com/media/536058960b3d91cfe80bde21b7e895e3/href</a></iframe><p>The above works fine, but what happens if we need access to data from languages from the translations reducer? If you’re using combineReducers you will only have access to your reducer’s state. Instead you can use the following pattern to create a custom reducer function that combines your reducers, and passes the required data across reducers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2e8638c6e4efa5b1652f2dae8d2b3015/href">https://medium.com/media/2e8638c6e4efa5b1652f2dae8d2b3015/href</a></iframe><p>Although this pattern works well enough, I would not abuse it. If you find you’re having to frequently pass state across multiple reducers it may be a sign that your state shape needs work. Either way remember reducers are just functions — don’t be afraid to experiment!</p><p><strong>For more React, Redux, and JavaScript reading follow me on </strong><a href="https://medium.com/@ryandrewjohnson"><strong>Medium</strong></a><strong> or </strong><a href="https://twitter.com/ryandrewjohnson"><strong>Twitter</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=318de6db06cd" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/passing-state-between-reducers-in-redux-318de6db06cd">Passing state between reducers in Redux</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[One developer just trying to keep up]]></title>
            <link>https://medium.com/statuscode/im-a-developer-just-trying-to-keep-up-7e26efe074cb?source=rss-3e1c2751bed------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e26efe074cb</guid>
            <category><![CDATA[javascript-frameworks]]></category>
            <category><![CDATA[javascript-fatigue]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Ryan Johnson]]></dc:creator>
            <pubDate>Sun, 24 Sep 2017 21:22:12 GMT</pubDate>
            <atom:updated>2018-05-25T12:58:26.048Z</atom:updated>
            <content:encoded><![CDATA[<h3>Always Be Learnin’: My Developer Fatigue Story</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DrMgMCGC864q5ssY6_EQ7Q.png" /></figure><p>I’m a developer, and I love what I do!</p><p>I have been doing this for 10+ years now, and a lot of things have changed since I dipped my toes into programming — Macromedia Flash anyone? Yep, programming for me started with stringing together MovieClips with sexy code like goToAndPlay(10)… let’s pour one out for ActionScript folks.🍾🍾</p><p>From there it’s been a freight train of new things year after year … from jQuery, Facebook Apps 🤢, HTML5, Backbone, Angular, and React. Let’s not forget a brief foray into Ruby on Rails, good ol’ PHP, Node.js, and the endless string of build tools — looking at you Grunt/Gulp/Webpack. I could go on and on, which brings me to the primary point of this article…</p><blockquote>Being a developer is awesome, but I often feel the pressure of “keeping up” overwhelming!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*nKT5PWQ9uCG-wuQgVQNozQ.jpeg" /></figure><h3>“keeping up” with the latest and greatest</h3><p>When you’re a developer it’s like signing a contract that says I will never be done learning. I think continued learning is an integral part to any good developer’s growth, but things change at such a furious pace that this can be draining. Even more stress is added when you consider that your valuable time may be spent learning something that could be obsolete in six months.</p><p>For me the pressure to keep up with the latest and greatest becomes daunting at times. I have often thought, if I’m ever lucky enough to have extended time off work would I truly be able to unplug during that time? Sure, my core skills would remain intact, but upon my return I could find that React is old news, and <em>AwesomeSauceJS</em> is the new treat of the week — looks like all my previous expertise is out the window. Ok ok… that may be an exaggeration, but this doesn’t prevent these thoughts from crossing my mind when I take time off.</p><h3>“keeping up” with others</h3><p>Have you ever looked at someone’s Instagram feed, and thought damn that person’s life looks amazing. In reality we’re only getting a glimpse of a polished version of that person’s life with all the “bad” filtered out. I feel the same goes when you’re a developer looking through your Twitter, GitHub, or some other social platform — you can’t help but constantly compare yourself to your peers.</p><ul><li>How in the hell does this person have 100k followers? Shit! Looks like I need to message everyone in Canada asking for a follow.</li><li>What!! <em>wobblybits.js</em> just got another 500 ⭐️’s on Github? My open source projects must be suck!</li><li>Holy crap that developer just spoke at 20 conferences last month! I can’t even put together a damn lunch and learn for work.</li><li>Wow! @megadevloper2000 just published a new library, released a new podcast, and managed to write a book on teaching your dog to program.</li></ul><p>Obviously these are exaggerations, but my primary point is an hour on Twitter can easily have you questioning the work you’re doing or not doing. Can this same content be used for motivation? For sure, but at the same time, like that perfect Instagram feed, it can have you unfairly weighing your success based on what others are sharing and doing.</p><h3>In closing</h3><p>At the end of the day if this is the worst part about being a developer then we are sitting pretty. I feel privileged to be part of this community, and look forward to many more years of growth in the industry. If you happen to relate to any of this I find the following reminders help when I’m feeling overwhelmed:</p><ul><li>If you have time to learn something new that’s great! Make sure to choose something that excites you, and you’re not picking it up because of outside pressure.</li><li>If you’re not in the right mindset, or don’t have the time to learn something new — don’t force it! This will just create more stress on your end, and most likely result in a negative learning experience.</li><li>Be your own judge and jury when it comes to measuring your success, and don’t let comparing your accomplishments to other’s diminish your own.</li><li>People on Twitter pissing you off? That OS project not motivating you anymore? — Don’t be afraid to unplug, even if it’s just for the night it can make all the difference.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AnDyrLgCPKfHcaSBYJaXyA.png" /></figure><p><strong>For more React, Redux, and JavaScript reading follow me on </strong><a href="https://medium.com/@ryandrewjohnson"><strong>Medium</strong></a><strong> or </strong><a href="https://twitter.com/ryandrewjohnson"><strong>Twitter</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e26efe074cb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/statuscode/im-a-developer-just-trying-to-keep-up-7e26efe074cb">One developer just trying to keep up</a> was originally published in <a href="https://medium.com/statuscode">Statuscode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I gave Flow a shot after TypeScript]]></title>
            <link>https://medium.com/netscape/why-i-gave-flow-a-shot-after-typescript-3fbb44ffc43d?source=rss-3e1c2751bed------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fbb44ffc43d</guid>
            <category><![CDATA[flow]]></category>
            <category><![CDATA[flowtype]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ryan Johnson]]></dc:creator>
            <pubDate>Fri, 08 Sep 2017 09:59:33 GMT</pubDate>
            <atom:updated>2019-01-29T19:46:43.747Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SzbaGYZvzA9jL1QwJdPELw.png" /></figure><blockquote>UPDATE: Since this article was published a lot has changed. The majority of the issues I had with TypeScript have been resolved, and it appears that TypeScript has pulled ahead as the tool of choice for JS type checking. I’m even moving my own projects from Flow to TypeScript.</blockquote><p>I must admit when I first tried TypeScript on a project I was skeptical. After all this is JavaScript we’re talking about — what the hell do I need types for? But after having used it on a large team project over the last eight months I’ve really come to depend on the stability types bring to a shared codebase.</p><p>But here’s the thing…that type safety came with some baggage as well. Here are some items I found to be a pain point with TypeScript:</p><ul><li>All your files use the .ts extension instead of .js — it might just be me but this always felt dirty.</li><li>No easy opt-in option if you want to slowly introduce TypeScript into an existing project — felt like all or nothing. <em>(Update: See </em><a href="https://blog.mariusschulz.com/2017/06/16/typescript-2-3-type-checking-javascript-files-with-checkjs"><em>Type-Checking JavaScript Files with — checkJs</em></a><em> for a way to migrate an existing project to TypeScript)</em></li><li>Tooling overhead —you may find that you need to add additional dependencies so your tooling can handle .ts files. (e.g. unit tests)</li></ul><p>These are some of the sticking points that led me to give <a href="https://flow.org/en/"><strong>Flow</strong></a> a try, and although it’s still early, I’m liking what I see so far, and here’s why…</p><h3>Your files are still JavaScript</h3><p>This may seem like a small thing, but at the end of the day you get to keep that .js extension, and all your files remain JavaScript. You only need ensure that Flow types are stripped from your files during your build. If you happen to be using babel this is as simple as adding <a href="https://www.npmjs.com/package/babel-preset-flow">babel-preset-flow</a> to your .babelrc file.</p><h3>Opting in is easy</h3><p>Want to add Flow to an existing project, but want to do it in small chunks? No problem, all you need to do is add // @flow to the files you wish to use Flow in — that’s it!</p><h3>Less strict with dependency type definitions</h3><p>This could have been specific to my project’s configuration, but TypeScript would always complain about third-party libraries missing type definitions. This would then involve checking if a type file exists, and then installing it. This was extra painful when trying to convert an existing project with many dependencies, as you have to install these type definitions one by one.</p><p>Where I found Flow would simply ignore those dependencies that were missing type definitions. And if you wanted to add definitions it was super easy with <a href="https://github.com/flowtype/flow-typed">flow-typed</a>, which will automatically installs definitions based on your package.json. An added bonus — if a definition for one of your dependencies doesn’t exist inflow-typed it automatically stubs out a file definition for you.</p><h3>Focused on static type checking only</h3><p>Flow is a static type checker for your JavaScript code — that’s it. Not a transpiler, not a superset of JavaScript, just a type checker. It does one thing, and it does it well.</p><h3>Great support</h3><p>When I hit a few roadblocks during development I reached out directly to the <a href="https://medium.com/u/17061f53660">Flow</a> twitter account, and I was answered directly by <a href="https://medium.com/u/d7533f31b8ab">Caleb Meredith</a> part of the Flow team. This help was invaluable, and it was such a welcome surprise considering how busy these guys must be.</p><h3><strong>Want to give Flow a go?</strong></h3><p>I’m still new to Flow, but I have enjoyed working with it thus far, and hope to continue using it in future projects. If you want to check it out for yourself I’ve included some resources that I found helpful along the way:</p><ul><li><a href="https://flow.org/en/docs/">Official Flow Docs</a></li><li><a href="https://github.com/flowtype/flow-typed">flow-typed</a> —A central repository for Flow library definitions</li><li><a href="https://github.com/graphql/graphql-js">graphql</a> &amp; <a href="https://github.com/erikras/redux-form">redux-form</a> — These projects source files are a great resource as they both use Flow.</li><li><a href="https://javascriptplayground.com/blog/2017/01/npm-flowjs-javascript/">Authoring and publishing JavaScript modules with Flow</a></li><li><a href="https://flow.org/try/">Online Flow editor</a></li></ul><blockquote><strong><em>For more React, Redux, and JavaScript reading follow me on </em></strong><a href="https://medium.com/@ryandrewjohnson"><strong><em>Medium</em></strong></a><strong><em> or </em></strong><a href="https://twitter.com/ryandrewjohnson"><strong><em>Twitter</em></strong></a><strong><em>.</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fbb44ffc43d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/netscape/why-i-gave-flow-a-shot-after-typescript-3fbb44ffc43d">Why I gave Flow a shot after TypeScript</a> was originally published in <a href="https://medium.com/netscape">Netscape</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ react-localize-redux v2 ]]></title>
            <link>https://codeburst.io/react-localize-redux-v2-f5fc2e4eab5f?source=rss-3e1c2751bed------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5fc2e4eab5f</guid>
            <category><![CDATA[react-redux]]></category>
            <category><![CDATA[localization]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[redux]]></category>
            <dc:creator><![CDATA[Ryan Johnson]]></dc:creator>
            <pubDate>Wed, 21 Jun 2017 01:54:12 GMT</pubDate>
            <atom:updated>2018-06-08T15:25:53.340Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Hg5LMvLmWCmEg-ICeUtjg.png" /></figure><h4>Simplified usage, selector optimizations, plus more!</h4><blockquote>NOTE: This article is out of date as <a href="https://github.com/ryandrewjohnson/react-localize-redux">v 3.0</a> has been released, and now works without Redux by default. Please see the <a href="https://ryandrewjohnson.github.io/react-localize-redux-docs/">official docs</a> or the <a href="https://medium.com/@ryandrewjohnson/react-localize-redux-3-0-47357510751e">official release</a> announcement for details.</blockquote><p>The original version of <a href="https://github.com/ryandrewjohnson/react-localize-redux">react-localize-redux</a> was created based on some work I did on a client project, and although it worked fairly well I knew there was room for improvement. With v2 I was able to realize many of these improvements.</p><blockquote><strong>React Localize Redux</strong> is a collection of helpers for managing localized content in your React/Redux application. For full details on Installation, Usage, etc.. visit the <a href="https://github.com/ryandrewjohnson/react-localize-redux">official github page</a> or read <a href="https://medium.com/@ryandrewjohnson/adding-multi-language-support-to-your-react-redux-app-cf6e64250050">Dead simple localization for your React components</a>.</blockquote><h3>Simplify that 💩…</h3><h4><a href="https://github.com/ryandrewjohnson/react-localize-redux#3-add-localized-translation-data">No more global vs local translations</a></h4><p>In v1 there was the concept of local vs global translations, which resulted in additional complexity. In v2 all translations are one and the same, and any component can access a translation as soon as it’s added.</p><h4><a href="https://github.com/ryandrewjohnson/react-localize-redux#3-add-localized-translation-data">Reduce repetition in translation data</a></h4><p>In v1 translation data looked something like the example below — where each supported locale repeated the same keys over and over 😔.</p><pre>{<br>  &quot;en&quot;: {<br>    &quot;greeting&quot;: &quot;Hello&quot;,<br>    &quot;farwell&quot;: &quot;Goodbye&quot;<br>  },<br>  &quot;fr&quot;: {<br>    &quot;greeting&quot;: &quot;Bonjour&quot;,<br>    &quot;farwell&quot;: &quot;Au revoir&quot;<br>  }<br>}</pre><p>In v2 I removed the redundancy by having one set of keys, and each key’s value having an array of translations like the below example 😃.</p><pre>{<br>  &quot;greeting&quot;: [&quot;Hello&quot;, &quot;Bonjour&quot;],<br>  &quot;farwell&quot;: [&quot;Goodbye&quot;, &quot;Au revoir&quot;]<br>}</pre><h4><a href="https://github.com/ryandrewjohnson/react-localize-redux#supports-nested-translation-data-to-avoid-naming-collisions">Support for nested translation data</a></h4><p>In v2 you now have more flexibility with formatting your translation data. Now you can nest your data, which can help with organization and avoid naming collisions.</p><pre>{<br>  &quot;welcome&quot;: {<br>    &quot;greeting&quot;: [&quot;Hello ${ name }!&quot;, &quot;Bonjour ${ name }!&quot;]<br>  },<br>  &quot;info&quot;: {<br>    &quot;greeting&quot;: [&quot;Hello&quot;, &quot;Bonjour&quot;]<br>  }<br>}</pre><p>Which you would then access like so in your component…</p><pre>&lt;h1&gt;{ translate(&#39;welcome.greeting&#39;, { name: &#39;Testy McTest&#39; }) }&lt;/h1&gt;<br>&lt;h1&gt;{ translate(&#39;info.greeting&#39;) }&lt;/h1&gt;</pre><h4>New selectors for components using connect</h4><p>In v1 the only way to get access to the translate and currentLanguage prop was to wrap your component with <a href="https://github.com/ryandrewjohnson/react-localize-redux#localizecomponent">localize</a>. For components that are already <a href="https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options">connected</a> you can now use the <a href="https://github.com/ryandrewjohnson/react-localize-redux#gettranslatestate">getTranslate</a> and <a href="https://github.com/ryandrewjohnson/react-localize-redux#getactivelanguagestate">getActiveLanguage</a> selectors instead.</p><p>In v1 you could end up with a scenario like this… 😔</p><pre>const Greeting = ({ translate, currentLanguage, onClick }) =&gt; (<br>  &lt;div&gt;<br>    &lt;h1&gt;{ translate(&#39;greeting&#39;) }&lt;/h1&gt;<br>    &lt;button onClick={ onClick }&gt;{ translate(&#39;farwell&#39;) }&lt;/button&gt;<br>  &lt;/div&gt;<br>);</pre><pre>const mapStateToProps = state =&gt; ({ onClick: clickHandler });</pre><pre>export default connect(mapStateToProps)(localize()(Greeting));</pre><p>In v2 this becomes… 😃</p><pre>const Greeting = ({ translate, currentLanguage, onClick }) =&gt; (<br>  &lt;div&gt;<br>    &lt;h1&gt;{ translate(&#39;greeting&#39;) }&lt;/h1&gt;<br>    &lt;button onClick={ onClick }&gt;{ translate(&#39;farwell&#39;) }&lt;/button&gt;<br>  &lt;/div&gt;<br>);</pre><pre>const mapStateToProps = state =&gt; ({ <br>  translate: getTranslate(state),<br>  currentLanguage: getActiveLanguage(state).code,<br>  onClick: clickHandler<br>});</pre><pre>export default connect(mapStateToProps)(Greeting);</pre><blockquote>NOTE: A simplified version of the <a href="https://github.com/ryandrewjohnson/react-localize-redux#localizecomponent">localize</a> method is still available in v2, and is perfectly fine to use for components not already using <a href="https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options">connect</a>.</blockquote><h3>Migrating from v1?</h3><p>The change to v2 did result in some breaking changes with v1, but I’ve created a <a href="https://github.com/ryandrewjohnson/react-localize-redux/blob/master/MIGRATING.md">migration guide</a> that will hopefully help out with anyone making the switch.</p><h3>Conclusion</h3><p>Thanks for your support and I hope you enjoy v2. As always feel free to send any feedback my way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5fc2e4eab5f" width="1" height="1" alt=""><hr><p><a href="https://codeburst.io/react-localize-redux-v2-f5fc2e4eab5f">💥 react-localize-redux v2 💥</a> was originally published in <a href="https://codeburst.io/">codeburst</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick Redux tips for connecting your React components]]></title>
            <link>https://medium.com/dailyjs/quick-redux-tips-for-connecting-your-react-components-e08da72f5b3?source=rss-3e1c2751bed------2</link>
            <guid isPermaLink="false">https://medium.com/p/e08da72f5b3</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-redux]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Ryan Johnson]]></dc:creator>
            <pubDate>Mon, 24 Apr 2017 02:35:25 GMT</pubDate>
            <atom:updated>2018-11-27T01:52:38.882Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*8sLFNiPIe_5yIBAapSAZDw.jpeg" /></figure><h4>Want to learn React? Check out my new course React for Beginners: Build and app, and learn the fundamentals.</h4><figure><a href="https://www.udemy.com/share/100GaX/"><img alt="" src="https://cdn-images-1.medium.com/max/700/1*wyLGOJ_w_ug5xrUshZAQgw.png" /></a></figure><figure><a href="https://skl.sh/2CssGg0"><img alt="" src="https://cdn-images-1.medium.com/max/700/1*-nT6jBnsk1Xco9wX_7CL2A.png" /></a></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*4877k4Hq9dPdtmvg9hnGFA.jpeg" /></figure><p>If you’re using Redux in your React app you’re likely using <a href="https://github.com/reactjs/react-redux">react-redux</a> to connect your components to your state. The connect method is a tricky sum bitch— although it has a very simple API there’s a lot of magic happening under the hood. It’s very easy, especially when first learning Redux, to just start connecting things without much thought on what’s actually happening. One of the easiest snafus to make is to connect your component at the top of the render tree.</p><p>What the hell does that mean exactly? I’m glad you asked — the following diagram demonstrates this scenario. In this example the &lt;Page&gt; component is connected at the top of the render tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*UKf3-68hl72fRRPxfV3BFA.png" /></figure><p><strong>Why does this suck?</strong></p><ul><li>You change the profile image the ENTIRE &lt;Page&gt; renders</li><li>You remove a feed from the list the ENTIRE &lt;Page&gt; renders</li><li>You add an image the ENTIRE &lt;Page&gt; renders</li></ul><p>Instead of connecting to the &lt;Page&gt; component let’s connect &lt;Profile&gt;, &lt;Feed&gt;, and &lt;Images&gt; directly to their slice of state. Here’s an updated version of the same diagram to demonstrate:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*PHeegr_hq92KGABD3HisWA.png" /></figure><h4><strong>Why is this better?</strong></h4><ul><li>Changing the profile image only &lt;Profile&gt; renders</li><li>Removing a feed from the list only &lt;Feed&gt; renders</li><li>Adding an image only &lt;Images&gt; renders</li><li>Less renders === 🌈🌈🦄🦄</li></ul><p>Remember when you connect your component you are telling React to render the component anytime any of the connected props changes. By having each component do it’s own connect we avoid the unnecessary renders that were happening when we connected at the top of the render tree.</p><h3>Wrapping up</h3><p>I recommend anyone new to connect takes the time to fully understand what is going on when you connect a Component. I myself was guilty of doing cut &amp; paste from tutorials at the beginning, and taking many missteps along the way.</p><h3>Bonus Round</h3><ol><li>If you are doing Redux I recommend taking a look at <a href="https://github.com/reactjs/reselect">reselect</a>. This allows you to create smart getters for Redux called selectors. A selector is not recomputed unless one of its arguments change, which will help avoid unnecessary renders.</li><li>Good ol’ RTFM — read the <a href="https://github.com/reactjs/react-redux">react-redux</a> docs in full. It turns out that the connect method has plenty of options beyond passing mapStateToProps and mapDispatchToProps, including a renderCountProp you can add to your component to track render count.</li></ol><h3>Ryan Johnson on Twitter</h3><p>Pass connect &quot;renderCountProp&quot; option to debug unnecessary renders - adds prop to connected component that tracks number of renders. 🔥🔥 https://t.co/zLDvjYm5nE</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*w5C-QG2pV9S7IiRn4r5tkg.png" /></figure><blockquote><strong><em>For more React, Redux, and JavaScript reading follow me on </em></strong><a href="https://medium.com/@ryandrewjohnson"><strong><em>Medium</em></strong></a><strong><em> or </em></strong><a href="https://twitter.com/ryandrewjohnson"><strong><em>Twitter</em></strong></a><strong><em>.</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e08da72f5b3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dailyjs/quick-redux-tips-for-connecting-your-react-components-e08da72f5b3">Quick Redux tips for connecting your React components</a> was originally published in <a href="https://medium.com/dailyjs">DailyJS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>