<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jonathan Cutrell</title>
    <description>The latest articles on DEV Community by Jonathan Cutrell (@jcutrell).</description>
    <link>https://dev.to/jcutrell</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F319%2Fae45bf7a-fb33-43a1-9420-d943781bfe48.jpg</url>
      <title>DEV Community: Jonathan Cutrell</title>
      <link>https://dev.to/jcutrell</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jcutrell"/>
    <language>en</language>
    <item>
      <title>Test-Driven Meetings</title>
      <dc:creator>Jonathan Cutrell</dc:creator>
      <pubDate>Wed, 12 Jun 2019 13:54:18 +0000</pubDate>
      <link>https://dev.to/jcutrell/test-driven-meetings-4l3o</link>
      <guid>https://dev.to/jcutrell/test-driven-meetings-4l3o</guid>
      <description>&lt;p&gt;Write a test, make it fail. Write the code to make it work. Refactor.&lt;/p&gt;

&lt;p&gt;This "red-green" cycle is something most modern developers understand. Many of us have built our whole workflow with this concept in front and center.&lt;/p&gt;

&lt;p&gt;We also identify with each other's pain when it comes to meetings.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Why are we meeting again? Why does this meeting have to last 2 hours? Doesn't everyone already have this information? Wouldn't it be better if we would all just go back to our work? This isn't real work... it's just making us feel like we're working.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Some meetings feel more productive than others. Maybe you really enjoy daily standup meetings, but can hardly tolerate "town hall" meetings.&lt;/p&gt;

&lt;p&gt;Wherever you are in your career, you can make meetings drastically more useful by applying the test-driven model of thinking to your meeting schedule.&lt;/p&gt;

&lt;p&gt;Let's break it down!&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Look at your calendar and identify all events that are meetings.
&lt;/h2&gt;

&lt;p&gt;Not every event is a meeting. Make a calendar specific for your meeting events. If you have informal meetings, put them on the calendar too.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. In the calendar event, write out the &lt;em&gt;expected output&lt;/em&gt; of the meeting.
&lt;/h2&gt;

&lt;p&gt;Arguably, great functions always produce output. What will you take away from this meeting? Here are some types of output:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tasks - is your meeting intended to generate work to be completed?&lt;/li&gt;
&lt;li&gt;"Decision record" - wherever you keep documentation of your work in progress, the output of a meeting might be as simple as making a decision about something and documenting it.&lt;/li&gt;
&lt;li&gt;Notes - At the very least, your meeting should be able to output a simple summary about what was discussed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. In the calendar event, also write out the desired &lt;em&gt;side effects&lt;/em&gt; of the meeting.
&lt;/h2&gt;

&lt;p&gt;While most of your meetings should produce functional output, you will also have meetings intended to produce side effects. Here's a list of side effects you may care about.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Camaraderie - Does your team feel closer to each other after a meeting?&lt;/li&gt;
&lt;li&gt;Belonging / in-the-know - does your team feel like they are included on important information?&lt;/li&gt;
&lt;li&gt;Emotional support and expression - do your team members feel emotionally supported? Has everyone had a chance to express their opinions?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Don't fly blindly into a meeting.
&lt;/h3&gt;

&lt;p&gt;It's easy to ignore meeting prep as a practice. It's difficult to immediately see the value in &lt;em&gt;stopping&lt;/em&gt; the "important" work you are doing for something seemingly less important.&lt;/p&gt;

&lt;p&gt;Make your meetings matter by creating these expectations, and testing against them. If a meeting is failing to produce expectations, do what a good developer does when tests fail: refactor the meeting!&lt;/p&gt;

</description>
      <category>organization</category>
      <category>productivity</category>
      <category>psychology</category>
    </item>
    <item>
      <title>What languages are you learning or planning to learn, and why?</title>
      <dc:creator>Jonathan Cutrell</dc:creator>
      <pubDate>Mon, 03 Jun 2019 14:23:29 +0000</pubDate>
      <link>https://dev.to/jcutrell/what-languages-are-you-learning-or-planning-to-learn-and-why-1l0n</link>
      <guid>https://dev.to/jcutrell/what-languages-are-you-learning-or-planning-to-learn-and-why-1l0n</guid>
      <description>&lt;p&gt;Are you learning a new language? What is the reasoning behind what you are learning? What principles are you picking up along the way?&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>learning</category>
      <category>languages</category>
    </item>
    <item>
      <title>What mistake did you make last week?</title>
      <dc:creator>Jonathan Cutrell</dc:creator>
      <pubDate>Mon, 27 May 2019 13:33:09 +0000</pubDate>
      <link>https://dev.to/jcutrell/what-mistake-did-you-make-last-week-1nhb</link>
      <guid>https://dev.to/jcutrell/what-mistake-did-you-make-last-week-1nhb</guid>
      <description>&lt;p&gt;Growth comes from failure, and failure is inevitable. Share your story of a recent failure, no matter the size. Other people need to hear about it!&lt;/p&gt;

&lt;p&gt;You will probably get some encouragement along the way, and feel less vulnerable when you see that you're not alone in your mistakes.&lt;/p&gt;

&lt;p&gt;Let's get honest with each other!&lt;/p&gt;

</description>
      <category>question</category>
      <category>growth</category>
      <category>learning</category>
      <category>discuss</category>
    </item>
    <item>
      <title>React Anti-pattern: renderThing</title>
      <dc:creator>Jonathan Cutrell</dc:creator>
      <pubDate>Fri, 24 May 2019 16:46:58 +0000</pubDate>
      <link>https://dev.to/jcutrell/react-anti-pattern-renderthing-50nd</link>
      <guid>https://dev.to/jcutrell/react-anti-pattern-renderthing-50nd</guid>
      <description>&lt;p&gt;If you've done much with React, you've probably run into this kind of scenario:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Tabs&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;setActiveTab&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;activeTab&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;activeTab&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;renderTabs&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tabs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setActiveTab&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
           &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
           &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;activeTab&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;active&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Choose&lt;/span&gt; &lt;span class="nx"&gt;an&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Current&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;activeTab&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;nav&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;renderTabs&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/nav&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would be used like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Tabs&lt;/span&gt; &lt;span class="nx"&gt;tabs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{[{&lt;/span&gt;&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Tab One&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tab-one&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Tab Two&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;tab-two&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}]}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And this works! If this is all you need for this component forever, by all means, stop here!&lt;/p&gt;

&lt;p&gt;But if this code will change in the future, you're likely to end up with a confusing and long component.&lt;/p&gt;

&lt;p&gt;The first and most obvious refactor smell here is the &lt;code&gt;renderTabs&lt;/code&gt; method. A few things are wrong with this.&lt;/p&gt;

&lt;p&gt;First, the &lt;code&gt;Tabs&lt;/code&gt; component already has a &lt;code&gt;render&lt;/code&gt; method. So what's the difference between the &lt;code&gt;Tabs&lt;/code&gt; &lt;code&gt;render&lt;/code&gt; and the &lt;code&gt;renderTabs&lt;/code&gt; methods? In one, we are rendering the list of tabs. In the other, we are adding some context. We see this often with things like filtered lists.&lt;/p&gt;

&lt;p&gt;It may be tempting to wrap up this kind of rendering functionality inside the component specifically because the tabs need to share state somehow with the containing context.&lt;/p&gt;

&lt;p&gt;Let's think about how we might refactor this to be easier to understand.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;P.S. Let's assume you've got some kind of testing strategy. In this case, we're not going to write tests, but if you did, you'd probably want to assert that your list is rendering, and that clicking on your tabs renders out what you want it to render.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let's start by removing the renderTabs method. This is going to look ugly at first.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Tabs&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;setActiveTab&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;activeTab&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;activeTab&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Choose&lt;/span&gt; &lt;span class="nx"&gt;an&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Current&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;activeTab&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;nav&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tabs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setActiveTab&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
               &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
               &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;activeTab&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;active&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
              &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;          &lt;span class="p"&gt;))}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/nav&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is actually a perfectly fine component on its own. But in the future, you probably will have other places you want to use the same tab-style button, so let's see if we can make that button shareable.&lt;/p&gt;

&lt;p&gt;Let's look at a single tab on its own.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setActiveTab&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
   &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;activeTab&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;active&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's make this component a standalone &lt;em&gt;functional component&lt;/em&gt;. (In other words, we want the component to take props, but we don't need it to have its own state.)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;TabButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;active&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;tabId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tabId&lt;/span&gt;&lt;span class="p"&gt;)}}&lt;/span&gt;
    &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;active&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;active&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we have a functional component, we can integrate this back into our original Tabs component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;TabButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;active&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;tabId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tabId&lt;/span&gt;&lt;span class="p"&gt;)}}&lt;/span&gt;
    &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;active&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;active&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Tabs&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;setActiveTab&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;activeTab&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;activeTab&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;tabs&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;activeTab&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Choose&lt;/span&gt; &lt;span class="nx"&gt;an&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Current&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;activeTab&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;nav&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tabs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;TabButton&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setActiveTab&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
               &lt;span class="nx"&gt;active&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;activeTab&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
               &lt;span class="nx"&gt;tabId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
               &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
               &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;          &lt;span class="p"&gt;))}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/nav&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So what do we really gain here?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Removed unnecessary/confusing renderTabs button&lt;/li&gt;
&lt;li&gt;Created a reusable TabButton component that doesn't rely on any external state&lt;/li&gt;
&lt;li&gt;No API changes for the &lt;code&gt;Tabs&lt;/code&gt; interface&lt;/li&gt;
&lt;li&gt;Easier to reason about and separate concerns - two smaller components over one larger component.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This example is contrived and small, but you are almost certainly going to find places where &lt;code&gt;renderThing&lt;/code&gt; monsters show up.&lt;/p&gt;

&lt;p&gt;The refactoring pattern looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Remove the monster &lt;code&gt;renderThing&lt;/code&gt; method by moving that code back into the original render. Stop there if the code is reasonable.&lt;/li&gt;
&lt;li&gt;Isolate a subset of the rendered output to create a new component from. (Note that you may be able to move directly to this step and jump over step 1, but I like to move it back into the render method first to see if it makes sense to just leave it there.)&lt;/li&gt;
&lt;li&gt;Work to separate what pieces of state can go away. Ideally, shoot for a functional component; however, beware of a &lt;em&gt;vanity functional component&lt;/em&gt;, where you keep state that should be in the subcomponent in it's parent so you can make it "functional." This is far worse than having two well-designed stateful components.&lt;/li&gt;
&lt;li&gt;Incorporate your new component into your previous component, replacing markup. If you find yourself passing too many things directly into the child component, it's possible that you should have stopped at step #1 and not abstracted the component out at all.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Knowing when to abstract a component or routine out into its own dedicated component can be hard. Sometimes, it's purely preference; there is no one right way. When in doubt, smaller components are easier to reason about, but abstraction should have a purpose.&lt;/p&gt;

&lt;p&gt;What other refactoring patterns are you interested in seeing a writeup on? Comment and let me know!&lt;/p&gt;

</description>
      <category>react</category>
      <category>refactoring</category>
    </item>
    <item>
      <title>5 Things I wish I knew about searching for a job as a young developer</title>
      <dc:creator>Jonathan Cutrell</dc:creator>
      <pubDate>Fri, 24 May 2019 15:47:54 +0000</pubDate>
      <link>https://dev.to/jcutrell/5-things-i-wish-i-knew-about-searching-for-a-job-as-a-young-developer-4e9d</link>
      <guid>https://dev.to/jcutrell/5-things-i-wish-i-knew-about-searching-for-a-job-as-a-young-developer-4e9d</guid>
      <description>&lt;h2&gt;
  
  
  1. Companies want you to succeed.
&lt;/h2&gt;

&lt;p&gt;Companies spend a lot on hiring. Most companies would prefer to complete the hiring process quickly. They want you to succeed.&lt;/p&gt;

&lt;p&gt;If you understand this, instead of feeling like you are being scrutinized, recognize that there's a shared desire for you to succeed.&lt;/p&gt;

&lt;p&gt;There's not a perfect number for how much it costs to hire a developer, but you can do some basic math to figure out that it's &lt;a href="https://blog.qualified.io/the-hidden-cost-of-hiring-engineers-22-750-hire-3a53e16b78c3"&gt;probably at least $20k on average&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What this means is that the hiring manager has two competing incentives: 1. find the right candidate; 2. find the candidate quickly. The longer the search takes, the more expensive it is.&lt;/p&gt;

&lt;p&gt;But it's not just a monetary cost.&lt;/p&gt;

&lt;p&gt;It's to your advantage to understand that your potential employer is probably tired of interviews that don't pan out. They want to get to the work, and stop spinning their wheels. That can have a heavy emotional toll.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;tldr; The person interviewing you likely wants you to succeed. Join them in that mindset.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The right job might feel slightly out of reach
&lt;/h2&gt;

&lt;p&gt;If you apply for whatever feels safe today, you likely won't feel like you are growing. Apply for something out of reach! The worst that can happen is denial.&lt;/p&gt;

&lt;p&gt;Use some discretion here. If the job requires 10 years of experience and you're brand new to the career, it's probably a better idea to reach for the mid-level position that requires two years of experience instead.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;tldr; Give yourself the challenge and expectation that requires growth. Focus on jobs that are barely out of your reach. Avoid jobs that are easy, or are three times beyond your reach.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Reflect the posting in your resumé
&lt;/h2&gt;

&lt;p&gt;Reflecting the original job posting language can help you directly address the requirements outlined.&lt;/p&gt;

&lt;p&gt;Look for language used. For example, if the posting says "developer", don't use the term "engineer." If the posting mentions any requirements, address each one that you have relevant experience with. Rule of thumb: convert the job posting into a checklist, and make sure your resumé and/or cover letter hits all of those items.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;tldr; Match language and address the full job posting. Don't just send your resumé along without adjusting to meet all necessary criteria.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Your non-coding experience matters
&lt;/h2&gt;

&lt;p&gt;What you learn in other areas of your life and career is relevant to your experience as a developer, for a few reasons.&lt;/p&gt;

&lt;p&gt;First, your reasoning ability and mental models you build in a different domain are likely transferable to software development, whether directly or indirectly.&lt;/p&gt;

&lt;p&gt;Second, your habits, personality, and perspective are all incredibly important to your future employer. For example, previous job habits may show your ability to collaborate well with others, engage with clients, operate under uncertainty, or communicate complex topics with clarity. All of these skills can be exhibited in jobs that have nothing to do with software development.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;tldr; Most skills and experience are transferable and relevant, so don't leave out cross-industry employment and experience.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Connections are the goal; a job comes after
&lt;/h2&gt;

&lt;p&gt;No matter how good your resumé, cover letter, and experience is, you are most likely one of a large number of applicants for any given job. The wording of a particular line on your resumé is not going to move the needle very much. Most jobs come as a result of a personal connection. So, go make connections! Talk with people in the industry, discuss the problems they are facing, and learn about what &lt;em&gt;they&lt;/em&gt; love.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;tldr; Job postings are fine, but relationships trump all other avenues of job searching.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion and a final recommendation:
&lt;/h2&gt;

&lt;p&gt;When you are searching for a job, remind yourself that employers do not have an "all-seeing eye." Just because you don't get a job doesn't mean you couldn't &lt;em&gt;do that job.&lt;/em&gt; Be encouraged in your journey! Finding a job is hard, so it pays off to think differently about the process. I hope these tips can help you in your search. Good luck!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;P.S. - feel free to reach out for career advice. We also talk about topics like this on &lt;a href="https://spec.fm/podcasts/developer-tea"&gt;Developer Tea&lt;/a&gt; (a podcast for driven developers like you) all the time, so be sure to check that out!&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Three Things I Wish I had Learned Earlier in My Career as a Software Developer</title>
      <dc:creator>Jonathan Cutrell</dc:creator>
      <pubDate>Tue, 21 May 2019 01:47:09 +0000</pubDate>
      <link>https://dev.to/jcutrell/three-things-i-wish-i-had-learned-earlier-in-my-career-as-a-software-developer-13m</link>
      <guid>https://dev.to/jcutrell/three-things-i-wish-i-had-learned-earlier-in-my-career-as-a-software-developer-13m</guid>
      <description>&lt;p&gt;Three Things I Wish I had Learned Earlier in My Career as a Software Developer:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://spec.fm/podcasts/developer-tea/298247"&gt;https://spec.fm/podcasts/developer-tea/298247&lt;/a&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>learning</category>
    </item>
    <item>
      <title>Challenge for Day 19</title>
      <dc:creator>Jonathan Cutrell</dc:creator>
      <pubDate>Sat, 19 Jan 2019 05:01:00 +0000</pubDate>
      <link>https://dev.to/jcutrell/challenge-for-day-19-4ic</link>
      <guid>https://dev.to/jcutrell/challenge-for-day-19-4ic</guid>
      <description>&lt;p&gt;Putting how you feel into words can help you understand those feelings more completely. Today, take time to notice any particularly strong feeling, and try to explain that feeling in words. Start with the actual physical sensations you feel, and continue with more complex devices like metaphors.&lt;/p&gt;

</description>
      <category>teabreakchallenge</category>
      <category>softskills</category>
    </item>
    <item>
      <title>Tea Break Challenge #9 - #17</title>
      <dc:creator>Jonathan Cutrell</dc:creator>
      <pubDate>Thu, 17 Jan 2019 23:04:20 +0000</pubDate>
      <link>https://dev.to/jcutrell/tea-break-challenge-9---17-5573</link>
      <guid>https://dev.to/jcutrell/tea-break-challenge-9---17-5573</guid>
      <description>&lt;p&gt;&lt;em&gt;Day 10:&lt;/em&gt;&lt;br&gt;
Self control is a lot like a muscle; once you’ve exercised self-control in one area, it is perhaps easier to exercise it in another area. Decide on something you will (or will not) do today, and follow through as soon as possible.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Day 11:&lt;/em&gt;&lt;br&gt;
If you are like most people, you have a lot of incoming noise. Take some time to permanently silence one source of incoming noise. This might mean unsubscribing to a newsletter, turning off push notifications, or removing a recurring meeting from your calendar.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Day 12:&lt;/em&gt;&lt;br&gt;
Studies show that thank you notes are not only appreciated more than expected, but that people also overestimate how awkward giving one will feel. Give someone you know an unexpected note of appreciation today.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Day 13:&lt;/em&gt;&lt;br&gt;
Most of us carry around stress, but most of us don’t try to locate the source of that stress. Take 5 minutes to figure out what your biggest stressor is today.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Day 14:&lt;/em&gt;&lt;br&gt;
Naming things is very important, and very hard. The next thing you name - a file, a concept, a presentation, or a variable - take an extra pass over it and evaluate the quality of your naming.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Day 15:&lt;/em&gt;&lt;br&gt;
Take out a sheet of paper and write down the basic schedule of your day. What things stand out to you as most useful? What things stand out as time wasters? How are you prioritizing these things?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Day 16:&lt;/em&gt;&lt;br&gt;
Best practices always require context. Today, when encountering a situation where you might use a best practice, ask yourself how it works in this specific context.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Day 17:&lt;/em&gt;&lt;br&gt;
Variety can provide major benefits to our mental schema and life experience. Take a different route home, try a new food, or listen to a genre you’ve never heard before today.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Tea Break Challenge, Day #8</title>
      <dc:creator>Jonathan Cutrell</dc:creator>
      <pubDate>Wed, 09 Jan 2019 00:07:44 +0000</pubDate>
      <link>https://dev.to/jcutrell/tea-break-challenge-day-8-3i6p</link>
      <guid>https://dev.to/jcutrell/tea-break-challenge-day-8-3i6p</guid>
      <description>&lt;p&gt;Today, make it a point to notice things that make you feel happy, satisfied, or otherwise positive emotions. Write them down, and put stars next to the things that really stand out to you. Adopting this habit can help you learn about your own preferences and values in an observatory way.&lt;/p&gt;

</description>
      <category>career</category>
      <category>softskills</category>
    </item>
    <item>
      <title>Tea Break Challenge Day #6 + Day #7</title>
      <dc:creator>Jonathan Cutrell</dc:creator>
      <pubDate>Mon, 07 Jan 2019 13:17:25 +0000</pubDate>
      <link>https://dev.to/jcutrell/tea-break-challenge-day-6--day-7-2koc</link>
      <guid>https://dev.to/jcutrell/tea-break-challenge-day-6--day-7-2koc</guid>
      <description>&lt;h3&gt;
  
  
  Day #6
&lt;/h3&gt;

&lt;p&gt;Today, take 5 minutes to clean something around you. This could be your inbox, or it could be making your bed. The simple act of doing something positive for your environment can have a positive effect on your mood and productivity.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://tea.is/d/6"&gt;http://tea.is/d/6&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Day #7
&lt;/h3&gt;

&lt;p&gt;Your challenge today is to abstain from all social media for at least one full hour, and focus on something (anything) else for that full hour. Your focus does not have to be on code; the goal here is to get better at focusing, not to do “more work.”&lt;/p&gt;

&lt;p&gt;&lt;a href="http://tea.is/d/6"&gt;http://tea.is/d/6&lt;/a&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>softskills</category>
    </item>
    <item>
      <title>Tea Break Challenge, Day #5</title>
      <dc:creator>Jonathan Cutrell</dc:creator>
      <pubDate>Sat, 05 Jan 2019 22:06:31 +0000</pubDate>
      <link>https://dev.to/jcutrell/tea-break-challenge-day-5-2d38</link>
      <guid>https://dev.to/jcutrell/tea-break-challenge-day-5-2d38</guid>
      <description>&lt;p&gt;Take 3 minutes today to listen with 100% focus to someone else’s story, opinion, complaint, or celebration. Try to understand what they are feeling, thinking, and experiencing.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://tea.is/d/5"&gt;http://tea.is/d/5&lt;/a&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>softskills</category>
      <category>teabreakchallenge</category>
    </item>
    <item>
      <title>Tea Break Challenge, Day #4</title>
      <dc:creator>Jonathan Cutrell</dc:creator>
      <pubDate>Fri, 04 Jan 2019 16:22:56 +0000</pubDate>
      <link>https://dev.to/jcutrell/tea-break-challenge-day-4-1i39</link>
      <guid>https://dev.to/jcutrell/tea-break-challenge-day-4-1i39</guid>
      <description>&lt;p&gt;Intuition is a very powerful tool; it can lead to amazing outcomes, both good and bad. Reflect on a recent event where your intuition served you well.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://tea.is/d/4"&gt;http://tea.is/d/4&lt;/a&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>teabreakchallenge</category>
    </item>
  </channel>
</rss>
