<?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" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Storybook - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Storybook - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Mon, 25 May 2026 20:15:46 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/storybook/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ What is Storybook and How Can I Use It to Create a Component Library in React? ]]>
                </title>
                <description>
                    <![CDATA[ Frameworks like React, Vue, and Angular all help developers create modular systems using components, but that doesn't usually include a good way to see them all from a higher point of view.  So how can we use Storybook to build libraries and design s... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/what-is-storybook-and-how-can-i-use-it-to-create-a-component-libary-in-react/</link>
                <guid isPermaLink="false">66b8e39c68c5b9f37d1d1af1</guid>
                
                    <category>
                        <![CDATA[ components ]]>
                    </category>
                
                    <category>
                        <![CDATA[ create-react-app ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Design Tools ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Developer Tools ]]>
                    </category>
                
                    <category>
                        <![CDATA[ framework ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Libraries ]]>
                    </category>
                
                    <category>
                        <![CDATA[ React ]]>
                    </category>
                
                    <category>
                        <![CDATA[ React ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Storybook ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tools ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Colby Fayock ]]>
                </dc:creator>
                <pubDate>Tue, 09 Jun 2020 14:45:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2020/06/storybook.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Frameworks like React, Vue, and Angular all help developers create modular systems using components, but that doesn't usually include a good way to see them all from a higher point of view. </p>
<p>So how can we use Storybook to build libraries and design systems that self-document as we build them?</p>
<ul>
<li><a class="post-section-overview" href="#heading-what-is-storybook">What is Storybook?</a></li>
<li><a class="post-section-overview" href="#heading-what-are-we-going-to-build">What are we going to build?</a></li>
<li><a class="post-section-overview" href="#heading-step-0-bootstrapping-an-app">Step 0: Bootstrapping an app</a></li>
<li><a class="post-section-overview" href="#heading-step-1-installing-storybook">Step 1: Installing Storybook</a></li>
<li><a class="post-section-overview" href="#heading-step-2-creating-a-new-button">Step 2: Creating a new button</a></li>
<li><a class="post-section-overview" href="#heading-step-3-using-our-new-button-component">Step 3: Using our new Button component</a></li>
<li><a class="post-section-overview" href="#heading-repeat-creating-a-new-header-component">Repeat: Creating a new Header component</a></li>
<li><a class="post-section-overview" href="#heading-more-storybook-features">More Storybook features</a></li>
</ul>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/VApXDsYO5Gg" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<h2 id="heading-what-is-storybook">What is Storybook?</h2>
<p><a target="_blank" href="https://storybook.js.org/">Storybook</a> is a JavaScript tool that allows developers to create organized UI systems making both the building process and documentation more efficient and easier to use.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/loneley-planet-storybook-example.jpg" alt="Image" width="600" height="400" loading="lazy">
<em><a target="_blank" href="https://lonelyplanet.github.io/backpack-ui/?path=/story/cards--card-basic">Lonely Planet's Backpack UI</a></em></p>
<p>Once you build out a component, Storybook lets you create a "story" file where you can then import your component and create various use case examples in an iFramed sandbox using that component.</p>
<p>This provides an organized and focused environment to build new components and work on existing ones.</p>
<h2 id="heading-what-are-we-going-to-build">What are we going to build?</h2>
<p>We're going to bootstrap a new <a target="_blank" href="https://reactjs.org/">React JS</a> app using <a target="_blank" href="https://reactjs.org/docs/create-a-new-react-app.html">Create React App</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/storybook-component-example.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Inside that app, we're going to install Storybook and create a few new components that will help us learn how to create new components that we can work on in a story and then use it in a React app.</p>
<h2 id="heading-step-0-bootstrapping-an-app">Step 0: Bootstrapping an app</h2>
<p>To get started, we're going to start from scratch with <a target="_blank" href="https://reactjs.org/docs/create-a-new-react-app.html">Create React App</a>. This will help us focus on getting productive in Storybook rather than walking through integrating it into a current app.</p>
<p>That said, if you're already working with an app created using Create React App that's not ejected, you should be able to still follow on with Part 1 and beyond just the same!</p>
<p>So let's get started by navigating to where we want to create our new app and run the Create React App command:</p>
<pre><code class="lang-shell">npx create-react-app my-storybook
</code></pre>
<p><em>Note: feel free to replace <code>my-storybook</code> with the directory name of your choice.</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/create-new-react-app.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Bootstrapping with Create React App</em></p>
<p>Once that's finished running, you can navigate to the directory:</p>
<pre><code class="lang-shell">cd my-storybook
</code></pre>
<p>And we're ready to go!</p>
<h2 id="heading-step-1-installing-storybook">Step 1: Installing Storybook</h2>
<p>Storybook luckily makes it really easy to get started with a standard installation of React. Particularly with Create React App, Storybook automatically detects that we're using an app created using CRA and installs the dependencies and scaffolds everything for us.</p>
<h3 id="heading-initializing-storybook">Initializing Storybook</h3>
<p>To get started installing Storybook, run:</p>
<pre><code class="lang-shell">npx -p @storybook/cli sb init
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/initializing-storybook.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Initializing Storybook in a React app</em></p>
<p>If you aren't using Create React App or it didn't work, you can check out their <a target="_blank" href="https://storybook.js.org/docs/guides/guide-react/">available guides in their docs</a>.</p>
<p>After that's finished, all of our Storybook dependencies should be installed.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/storybook-finished-installing.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Finished installing Storybook</em></p>
<h3 id="heading-starting-up-storybook">Starting up Storybook</h3>
<p>So now we're ready to get moving! Finally, run:</p>
<pre><code class="lang-shell">yarn storybook
# or
npm run storybook
</code></pre>
<p>And once everything finishes loading, Storybook will open a new tab in your browser and you should now see a welcome message inside of your new Storybook dashboard!</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/storybook-welcome-page.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Storybook welcome page</em></p>
<p><a target="_blank" href="https://github.com/colbyfayock/my-storybook/commit/3e994096384e31cb540150c9f14f41758ef3a746">Follow along with the commit!</a></p>
<h2 id="heading-step-2-creating-a-new-button">Step 2: Creating a new button</h2>
<p>If you took a second to poke around the dashboard, you might have noticed that it comes pre-loaded with a Button that's available as a demo.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/storybook-demo-button.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Storybook demo button</em></p>
<p>You should also notice if you click the button, you actually see an action print out inside of the Actions tab at the bottom. This shows the event that's captured from the button click.</p>
<p>It's simple, but this is great to get a nice feel about what to expect in storybook. The only issue is, this is meant purely for demonstration purposes, so let's build our own button to replace it.</p>
<h3 id="heading-creating-a-new-button-component">Creating a new Button component</h3>
<p>To get started, let's first create a few directories:</p>
<ul>
<li>Under <code>src</code>, create a new folder called <code>components</code></li>
<li>Under <code>components</code>, create a new folder called <code>Button</code></li>
</ul>
<p>Once you create those folders, create a new file called <code>index.js</code> inside of your <code>src/components/Button</code> folder and inside add:</p>
<pre><code class="lang-js"><span class="hljs-comment">// Inside src/components/Button/index.js</span>

<span class="hljs-keyword">export</span> { <span class="hljs-keyword">default</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'./Button'</span>;
</code></pre>
<p>This will import the next file we created called <code>Button.js</code> which will allow us to more easily import our files with <code>src/components/Button</code> instead of <code>/src/components/Button/Button</code>.</p>
<p>Next, let's create <code>Button.js</code> right next to our <code>index.js</code> file with the following content:</p>
<pre><code class="lang-js"><span class="hljs-comment">// Inside src/components/Button/Button.js</span>

<span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;

<span class="hljs-keyword">const</span> Button = <span class="hljs-function">(<span class="hljs-params">{ children, ...rest }</span>) =&gt;</span> {
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"button"</span> {<span class="hljs-attr">...rest</span>}&gt;</span>
      { children }
    <span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></span>
  )
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> Button;
</code></pre>
<p>Here, we're creating a new component called Button that adds a class of <code>button</code> to the element and passes through the <code>children</code>. We're a additionally <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">destructuring</a> the rest of the props into the <code>rest</code> variable and <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax">spreading</a> that value into the <code>&lt;button&gt;</code> element.</p>
<p>If you've followed along, your files should now look like this:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/button-reaect-component.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Button component in React</em></p>
<h3 id="heading-using-our-new-button-component">Using our new Button component</h3>
<p>So now that we have our Button component, let's use it!</p>
<p>Open up the file <code>src/stories/1-Button.stories.js</code> and replace the line that's importing <code>Button</code> with:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/updating-button-storybook-story.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Updating the Button Storybook story</em></p>
<p>And once you hit save, you can open back up your browser tab with your Storybook dashboard, and you can now see a button that looks mostly similar, but it uses the browser's default styles for the <code>&lt;button&gt;</code> element. You'll even notice that if you click it, the event will still be logged under the Actions tab.</p>
<h3 id="heading-styling-our-button-component">Styling our Button component</h3>
<p>Finally, we probably don't want to use the browser default styles, so let's make it look nice.</p>
<p>In our <code>src/components/Button</code> directory, add a new file <code>Button.css</code> and add the following content:</p>
<pre><code class="lang-css"><span class="hljs-comment">/* Inside src/components/Button/Button.css */</span>

<span class="hljs-selector-class">.button</span> {
  <span class="hljs-attribute">color</span>: white;
  <span class="hljs-attribute">font-weight</span>: bold;
  <span class="hljs-attribute">background-color</span>: blueviolet;
  <span class="hljs-attribute">border</span>: none;
  <span class="hljs-attribute">padding</span>: .<span class="hljs-number">8em</span> <span class="hljs-number">1em</span>;
  <span class="hljs-attribute">border-radius</span>: .<span class="hljs-number">2rem</span>;
}
</code></pre>
<p>This applies a few styles to our <code>.button</code> class like adding a background color and changing the font color to white.</p>
<p>But if you open Storybook, you'll notice it didn't do anything. To use it, we need to import it into our component.</p>
<p>Inside <code>src/components/Button/Button.js</code> add the following at the top under the React import:</p>
<pre><code class="lang-js"><span class="hljs-keyword">import</span> <span class="hljs-string">'./Button.css'</span>;
</code></pre>
<p>And once you save that and open up your browser, you should now see our new button with our updated styles!</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/new-button-storybook.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>New Button in Storybook</em></p>
<p><a target="_blank" href="https://github.com/colbyfayock/my-storybook/commit/e71e0e9e666adee0455b0b69118053c2f551ab68">Follow along with the commit!</a></p>
<h2 id="heading-step-3-using-our-new-button-component">Step 3: Using our new Button component</h2>
<p>The ultimate goal of our component is to use it right? So let's add it to our app.</p>
<h3 id="heading-switching-over-to-the-react-app">Switching over to the React app</h3>
<p>First we'll need to either start our React app in a new terminal tab or kill the Storybook process and start the React process there. To start the React app using Create React App, run:</p>
<pre><code class="lang-shell">yarn start
# or
npm run start
</code></pre>
<p>Once that loads, we should have our standard Create React App if you're following along with me:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/new-create-react-app.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>New Create React App</em></p>
<h3 id="heading-importing-and-using-the-new-button">Importing and using the new button</h3>
<p>Next, inside of <code>src/App.js</code>, let's import our new Button at the top of the page:</p>
<pre><code class="lang-js"><span class="hljs-keyword">import</span> Button <span class="hljs-keyword">from</span> <span class="hljs-string">'./components/Button'</span>;
</code></pre>
<p>With Button imported, we can use it. Here, we can simply add it anywhere we want in the page. I'm going to replace the Learn React link with:</p>
<pre><code class="lang-jsx">&lt;p&gt;
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Button</span>&gt;</span>Hello, Storybook!<span class="hljs-tag">&lt;/<span class="hljs-name">Button</span>&gt;</span></span>
&lt;/p&gt;
</code></pre>
<p>And if we save and reload the page, we should now see our Button on the page!</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/create-react-app-with-new-button.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>New Button in Create React App</em></p>
<p><a target="_blank" href="https://github.com/colbyfayock/my-storybook/commit/e6071aae5be281101d486c4cc7664bf6cacb4028">Follow along with the commit</a></p>
<h2 id="heading-repeat-creating-a-new-header-component">Repeat: Creating a new Header component</h2>
<p>The great thing about Storybook and React (or any of the supported frameworks) is that this process scales to as many components as you want.</p>
<p>So let's build another component!</p>
<h3 id="heading-creating-our-header-component">Creating our Header component</h3>
<p>Similar to our Button, let's start off by creating the set of directories and files that give us our component.</p>
<p>Since we already did this once, I'm going to provide the code without walking through what's going on.</p>
<p>Let's start off by spinning back up our Storybook server with:</p>
<pre><code>yarn storybook
# or 
npm run storybook
</code></pre><p>Create a <code>Header</code> directory inside the <code>src/components</code> directory.</p>
<p>Create an <code>index.js</code> file inside of <code>src/components/Header</code> with the following content:</p>
<pre><code class="lang-js"><span class="hljs-comment">// In src/components/Header/index.js</span>

<span class="hljs-keyword">export</span> { <span class="hljs-keyword">default</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'./Header'</span>;
</code></pre>
<p>Create a <code>Header.js</code> file inside of <code>src/components/Header</code> with the following content:</p>
<pre><code class="lang-jsx"><span class="hljs-comment">// In src/components/Header/Header.js</span>

<span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
<span class="hljs-keyword">import</span> <span class="hljs-string">'./Header.css'</span>;

<span class="hljs-keyword">const</span> Header = <span class="hljs-function">(<span class="hljs-params">{ children }</span>) =&gt;</span> {
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">h2</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"header"</span>&gt;</span>
      { children }
    <span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span></span>
  )
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> Header;
</code></pre>
<p>Create a <code>Header.css</code> file inside of <code>src/components/Header</code> with the following content:</p>
<pre><code class="lang-css"><span class="hljs-comment">/* In src/components/Header/Header.css */</span>

<span class="hljs-selector-class">.header</span> {
  <span class="hljs-attribute">font-family</span>: sans-serif;
  <span class="hljs-attribute">font-size</span>: <span class="hljs-number">2.5em</span>;
  <span class="hljs-attribute">color</span>: blueviolet;
  <span class="hljs-attribute">border-bottom</span>: solid <span class="hljs-number">5px</span> aqua;
  <span class="hljs-attribute">padding-bottom</span>: .<span class="hljs-number">2em</span>;
  <span class="hljs-attribute">box-shadow</span>: <span class="hljs-number">0</span> <span class="hljs-number">5px</span> <span class="hljs-number">0</span> blueviolet;
}
</code></pre>
<p>Now if you notice, if you try to open up Storybook, again, nothing will happen. This time we need to create a new story file.</p>
<h3 id="heading-creating-a-new-story-file">Creating a new Story file</h3>
<p>Inside <code>src/stories</code>, add a new file called <code>2-Header.stories.js</code>:</p>
<pre><code class="lang-jsx"><span class="hljs-comment">// Inside src/stories/2-Header.stories.js</span>

<span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;

<span class="hljs-keyword">import</span> Header <span class="hljs-keyword">from</span> <span class="hljs-string">'../components/Header'</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> {
  <span class="hljs-attr">title</span>: <span class="hljs-string">'Header'</span>,
  <span class="hljs-attr">component</span>: Header,
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> Text = <span class="hljs-function">() =&gt;</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Header</span>&gt;</span>Hello Header<span class="hljs-tag">&lt;/<span class="hljs-name">Header</span>&gt;</span></span>;
</code></pre>
<p>Here's a breakdown of our story file:</p>
<ul>
<li>First, we import our component – this is pretty standard any time we want to use it</li>
<li>The first thing we export is a <code>default</code> object. With Storybook, it expects the default export to be the configuration of our story, so here we provide it with a title and we pass in the component that we're using for this story</li>
<li>The second and last thing we export is the <code>Text</code> constant. With Storybook, any non-default export will be considered a variation that will get nested under the title that you provide in the default export</li>
</ul>
<p>And if you save this file and open up your Storybook dashboard in the browser, you should now see the new header!</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/new-header-storybook-story.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>New Header component in Storybook</em></p>
<h3 id="heading-using-the-header-component">Using the Header component</h3>
<p>Using our component is just the same as our Button component, so inside of <code>src/App.js</code>, let's add our Header.</p>
<p>After starting your React server, first import our new Header:</p>
<pre><code class="lang-js"><span class="hljs-comment">// In src/App.js</span>

<span class="hljs-keyword">import</span> Header <span class="hljs-keyword">from</span> <span class="hljs-string">'./components/Header'</span>;
</code></pre>
<p>Then add it to the top of the page:</p>
<pre><code class="lang-jsx"><span class="hljs-comment">// In src/App.js</span>

&lt;Header&gt;My App&lt;/Header&gt;
</code></pre>
<p>And if you open the page, we'll see our new Header!</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/create-react-app-with-header-and-button.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Create React App with new Header and Button components</em></p>
<p><a target="_blank" href="https://github.com/colbyfayock/my-storybook/commit/e1c59eccaf5f4146a2fe039dca8874609d615194">Follow along with the commit!</a></p>
<h2 id="heading-adding-more-components">Adding more components</h2>
<p>As you've noticed with our second Repeat step – adding a new component is pretty much the same process for any type of component we want to add. Once we have it in our library, we can develop it in a focused environment and then import it to our app to use.</p>
<p>You can now use this to manage your library of components and better maintain an entire system for your project!</p>
<h2 id="heading-more-storybook-features">More Storybook features</h2>
<p>Storybook doesn't stop with just adding components, it provides the ability to configure <a target="_blank" href="https://storybook.js.org/addons/">Addons</a> that enhance the core capabilities opening up a lot of possibilities.</p>
<p>Here are some of my favorites...</p>
<h3 id="heading-story-source">Story Source</h3>
<p>When building a component system, the hope is that people can easily use these components. But if you don't have documentation, someone would have to open up the file or try to find another use example.</p>
<p>Instead, <a target="_blank" href="https://github.com/storybookjs/storybook/tree/master/addons/storysource">Story Source</a> shows the code source of the story file you created allowing someone browsing your Storybook dashboard to get an example right along with the component output!</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/storybook-source-demo.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Storybook Story Source demo</em></p>
<h3 id="heading-storyshots">Storyshots</h3>
<p>If you're a fan of automated testing, you might have heard of using <a target="_blank" href="https://jestjs.io/">Jest</a> or another tool for adding snapshot testing to your app.</p>
<p><a target="_blank" href="https://github.com/storybookjs/storybook/tree/master/addons/storyshots/storyshots-core">StoryShots</a> is a way to easily add Jest snapshot testing to your component system. It creates snapshots based off of the stories you create so you can make sure that your components aren't fundamentally changing (or breaking) during development.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/06/storybook-snapshot-example.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Snapshot example with StoryShots</em></p>
<h2 id="heading-whats-your-favorite-part-of-storybook">What's your favorite part of Storybook?</h2>
<p><a target="_blank" href="https://twitter.com/colbyfayock">Share with me on Twitter!</a></p>
<h2 id="heading-continue-the-conversation">Continue the conversation!</h2>
<div class="embed-wrapper">
        <blockquote class="twitter-tweet">
          <a href="https://twitter.com/colbyfayock/status/1270392710260719616"></a>
        </blockquote>
        <script defer="" src="https://platform.twitter.com/widgets.js" charset="utf-8"></script></div>
<div id="colbyfayock-author-card">
  <p>
    <a href="https://twitter.com/colbyfayock">
      <img src="https://res.cloudinary.com/fay/image/upload/w_2000,h_400,c_fill,q_auto,f_auto/w_1020,c_fit,co_rgb:007079,g_north_west,x_635,y_70,l_text:Source%20Sans%20Pro_64_line_spacing_-10_bold:Colby%20Fayock/w_1020,c_fit,co_rgb:383f43,g_west,x_635,y_6,l_text:Source%20Sans%20Pro_44_line_spacing_0_normal:Follow%20me%20for%20more%20JavaScript%252c%20UX%252c%20and%20other%20interesting%20things!/w_1020,c_fit,co_rgb:007079,g_south_west,x_635,y_70,l_text:Source%20Sans%20Pro_40_line_spacing_-10_semibold:colbyfayock.com/w_300,c_fit,co_rgb:7c848a,g_north_west,x_1725,y_68,l_text:Source%20Sans%20Pro_40_line_spacing_-10_normal:colbyfayock/w_300,c_fit,co_rgb:7c848a,g_north_west,x_1725,y_145,l_text:Source%20Sans%20Pro_40_line_spacing_-10_normal:colbyfayock/w_300,c_fit,co_rgb:7c848a,g_north_west,x_1725,y_222,l_text:Source%20Sans%20Pro_40_line_spacing_-10_normal:colbyfayock/w_300,c_fit,co_rgb:7c848a,g_north_west,x_1725,y_295,l_text:Source%20Sans%20Pro_40_line_spacing_-10_normal:colbyfayock/v1/social-footer-card" alt="Follow me for more Javascript, UX, and other interesting things!" width="2000" height="400" loading="lazy">
    </a>
  </p>
  <ul>
    <li>
      <a href="https://twitter.com/colbyfayock">? Follow Me On Twitter</a>
    </li>
    <li>
      <a href="https://youtube.com/colbyfayock">?️ Subscribe To My Youtube</a>
    </li>
    <li>
      <a href="https://www.colbyfayock.com/newsletter/">✉️ Sign Up For My Newsletter</a>
    </li>
  </ul>
</div>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ My first week of open source: how I got involved, and what I’ve learned ]]>
                </title>
                <description>
                    <![CDATA[ By Chak Shun Yu When I started to write this post, I had finished my first serious week of contributing to open source. I mainly contributed to the project Storybook. This post will describe the contributions and interactions that took place this wee... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/the-path-of-my-first-week-of-open-source-contributions-87823aaeb872/</link>
                <guid isPermaLink="false">66c361f80cede4e9b1329ce8</guid>
                
                    <category>
                        <![CDATA[ Life lessons ]]>
                    </category>
                
                    <category>
                        <![CDATA[ open source ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Storybook ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 13 Jun 2018 21:27:10 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/0*oGS2HCMbtG_IFY3K." medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Chak Shun Yu</p>
<p>When I started to write this post, I had finished my first serious week of contributing to open source. I mainly contributed to the project <a target="_blank" href="https://storybook.js.org/">Storybook</a>. This post will describe the contributions and interactions that took place this week. It will also focus on the path that led up to this week.</p>
<p>I want to talk about the change in mindset and motivation that (finally) got me started. I will show you what I did to get to my first contribution, and I will share what I learned from this week and my experience of everything as a whole.</p>
<p>While I’m aware that one week has not made me an open source expert, the stories I describe will be from my own subjective perspective. Developers trying to get into open source, like me before this week, might find some value in reading the story of someone in very similar shoes.</p>
<p>In this post, I won’t go over the basics about getting into open source. I will not cover how to choose a project to contribute to. Nor will I cover why, how, and what you should contribute to the project. <a target="_blank" href="https://opensource.guide/how-to-contribute/">Open Source Guides</a> covers all these topics very well. You should definitely check it out if you’re looking for advice regarding those topics.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/KONcC2tWywcLmOrtduE4z7uJX6bD5XWC2kda" alt="Image" width="800" height="475" loading="lazy">
_“A highway down a countryside with a red wheat field” by [Unsplash](https://unsplash.com/@alice_hampson?utm_source=medium&amp;utm_medium=referral" rel="noopener" target="_blank" title=""&gt;Alice Hampson on &lt;a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral" rel="noopener" target="<em>blank" title=")</em></p>
<h4 id="heading-motivation-and-mindset">Motivation and Mindset</h4>
<p>While this week has been pretty awesome and enjoyable, the journey up until this point has most definitely not been a walk on a flowery path.</p>
<p>Let me provide you with some context about me. I’m currently a second year MSc student in Computer Science at the Delft University of Technology. I would describe myself as a (below) average developer compared to my peers. I didn’t really start programming before I got into my Bachelors. I never found the motivation to do so outside of courses.</p>
<p>It has been over a year now since I first heard about the mysterious phenomenon of open-source programming from a colleague. This colleague also described all the benefits, both for personal development and for my career.</p>
<p>My inner developer kicked in and was like <em>“Oh that’s super awesome, I should do that so I can learn a lot and increase my chances for a job in the future!”</em>, but then my inner student kicked in and was like <em>“Why should I burden myself with more</em> <strong><em>obligations</em></strong> <em>than I already have (from university) though?”</em>.</p>
<p>Fast forward a year. While I’m already improving my development skills in alternative ways, I still hadn’t touched open source in any voluntary or serious way. I expect to graduate during the Autumn of this year. Then I will get into the job market which is nothing out of the ordinary.</p>
<p>In these past months, however, I’ve started to take my future quite seriously. I am already exploring opportunities through career fairs, in-house days, and staying in touch with companies.</p>
<p>While this is great and all, there’s still one thing that I lack: <strong>experience.</strong> Especially in a established environment (like a company). While a part-time job on the side is <em>an</em> option, the main thing on my mind right now is to focus on my MSc thesis and graduate. Everything else is just kinda of on the side. So, in the end, I don’t really consider a part-time job to be an option <em>for me</em>.</p>
<p>During these months, I’ve looked for alternative opportunities to gain experience. I have looked into hobby projects and a small programming side job at the university. Those still aren’t quite what I’m looking for.</p>
<p>But one day, the thought came across my mind that I could gain the experience that I was looking for through open-source contributions. Provided that I chose the projects carefully to meet my needs. Because, in the end, open-source projects are very similar to companies. The only difference is that the employees are fighting to get work, rather than to avoid it. ?</p>
<p>After this week, I’ve noticed how my mindset and motivation has changed compared to last year. I credit this change as the reason that I could get into open source now. The lack of motivation is the reason that I failed before.</p>
<p>Before, I only thought about it as a way to improve my résumé. This relates to how I initially saw it as an obligation. In the long run, that would never keep me motivated. Even worse, it would never motivate me enough to begin in the first place, which is exactly what was the case during this year.</p>
<p>Now, on one hand I see it as an alternative way to obtain experience in a company-like environment. But more than that, I want to enhance and develop my skills, both in programming and communication.</p>
<p>And that’s the main thing that keeps me going right now. I can actually motivate myself to spend time doing open-source programming. Not because then I can apply for that particular job offer. Not because I can then put it on my résumé…but because I actually <strong>want</strong> to become a better developer myself. It’s all for myself. That is a motivation that will most definitely not suddenly fade out or not be strong enough.</p>
<p>The best practical example of this in practice is the context of my first contribution. On a Thursday (the 19th of April) I was basically working at my uni job the entire day. It was a pretty early morning for my standards, starting at 10:00 which means waking up at 8:00 for me. And we didn’t finish until 18:30, which made it a pretty long day. After coming back home and finishing dinner, it was basically already 20:00. Any other day, I would’ve either fallen asleep on the couch or taken it chill the rest of the evening.</p>
<p>That evening, however, a <a target="_blank" href="https://github.com/storybooks/storybook/issues/3384#issuecomment-382812208">certain Github issue</a> reached my mailbox. (I will discuss later why and how it got there ?). It caught my attention because it felt like something I could solve. I basically rushed to my laptop, and left a message on the issue that I would be willing to give it a try.</p>
<p>I spent a few hours working on it, before eventually hitting my friend up to play some games as usual. Even when I think back about it now, I’m still extremely surprised that I was <strong>willing</strong> to do more programming after such a long day for my standards. Again, I credit all this to the above stated change in mindset and motivation.</p>
<h4 id="heading-my-choice-of-projects">My Choice of Projects</h4>
<p>As I said before, the <a target="_blank" href="https://opensource.guide/how-to-contribute/">Open Source Guides</a> already covers a lot of the initial steps for getting into Open Source programming. They even include how to find a project to contribute to. Therefore, this section will be dedicated to my choices in projects, my preferences, and how it affected my choices.</p>
<p>At the moment, my main interest and the field that I’m focusing on improving the most in is web development. Especially React — it’s the library that I’ve come to love and feel most comfortable with. So naturally, I wanted to find projects that were related to web development. For me, the project being written (partially) in JavaScript was a must, while involving or being related to React was a plus.</p>
<p>On top of that, I wanted the project to be a slightly- to decently-established project in the community. I wanted to mimic the experience of working in a company-like environment. And being able to say that you worked on <em>-insert widely used library or project in the community-</em> definitely sounds cool in any conversation or interview ?.</p>
<p>The full list of projects that I looked into consisted of projects found through <a target="_blank" href="https://github.com/search?o=desc&amp;q=react&amp;s=stars&amp;type=Repositories">searching “React” on Github</a> and ones that I knew or had heard of: <a target="_blank" href="https://github.com/facebook/react">React</a>, <a target="_blank" href="https://github.com/reactjs/react-redux">Redux</a>, <a target="_blank" href="https://github.com/mobxjs/mobx">MobX</a>, <a target="_blank" href="https://github.com/ReactTraining/react-router">React-Router</a>, <a target="_blank" href="https://github.com/zeit/next.js/">Next.js</a>, <a target="_blank" href="https://github.com/styled-components/styled-components">styled-components</a>, <a target="_blank" href="https://github.com/storybooks/storybook">Storybook</a>, <a target="_blank" href="https://github.com/withspectrum/spectrum">Spectrum</a>, and more…</p>
<p>In the end, I stuck to styled-components, Storybook, and Spectrum. Mainly because the other projects felt relatively abstract and more difficult to understand. These projects were very new-contributor friendly. Plus they are still widely used in the community.</p>
<p>Over that one week, and between these 3 projects, all but one of my contributions were towards Storybook. My first contribution was towards Storybook, and I really liked the flow of it. At that time there happened to be more issues that I felt I was capable of tackling, so I continued with it!</p>
<h4 id="heading-making-my-first-contribution">Making My First Contribution</h4>
<p>So I’ve already talked about the context of my first contribution. I haven’t talked about the technical details of the <a target="_blank" href="https://help.github.com/articles/about-pull-requests/">Pull Request (PR)</a>, however. Or how I got to the PR in the first place, which will be the focus of this section.</p>
<p>The best thing that I did to increase my knowledge and understanding of all the projects was <a target="_blank" href="https://help.github.com/articles/watching-and-unwatching-repositories/#watching-a-single-repository">watching all the repositories</a> that I was interested in. This is also the biggest recommendation that I can give to people that are new, like I am, to any open-source project. This spammed my mailbox with any activity in the projects, be it the creation of an issue or PR, or any comment in it.</p>
<p>Then, whenever I had some free time on my hands, I would go through all the emails. I would process the ones that I could understand. Someone made a PR and the title doesn’t sound like complete magic? Let me take a look at what they did and how. Oh, there’s a active discussion going on in this issue and it doesn’t sound overwhelming? Let’s follow that conversation as well!</p>
<p>The pattern here is that I tried to extract as much information and knowledge about the project by exposing myself to what others were doing. Watching the repository guaranteed that any information I was consuming would be recent.</p>
<p>The current problem or implementation that I was learning about was useful for the project at that point. Of course, there were scenarios where, no matter how hard I tried, I just couldn’t see myself participating meaningfully. Although this can feel very demotivating, it’s also completely normal if you think about it carefully.</p>
<p>In the beginning, I was archiving a lot of emails, because I just lacked the knowledge to understand the issue. Instead, I focused on the ones I could and the ones that I wasn’t sure about whether I could. No matter what the result was, I would just try to go through them and understand.</p>
<p>If I couldn’t, then I would know where my limitations were and still learned about the project in some way or another. If I could, then I extended my knowledge on the project as well, and I could potentially contribute to solving the issue. Of course, especially if the project was very active, it was very hard to keep up with all the emails. I just tried as much as I could afford, hoping it would help me in the long run — which it did!</p>
<p>At some point, someone opened an issue. The issue described some problems with the Storybook CLI during the installation process. It turned out that Storybook prefers to use yarn. However, not everybody uses yarn, and npm is still significantly used in the field.</p>
<p>To cover for these cases, the CLI would run the yarn — version command to check whether yarn was installed. If so, it would use it as the package manger of choice to install dependencies. The issue arose, however, when developers had both package managers installed, but mainly used npm. Storybook would then use the old version of yarn. This resulted in the issues reported by the current user.</p>
<p>This sounded like something that I understood and felt capable of fixing! So what did I do then? I started of with politely asking whether it was okay for me to tackle this issue.</p>
<p>There are several reasons that I explicitly asked this, rather than just doing it.</p>
<ol>
<li>It signals than <em>somebody</em> is working on the issue, which is great for the maintainers.</li>
<li>It clarifies that <em>you</em> are working on it and that you claimed the issue. This is especially useful in highly active projects.</li>
<li>It makes sure that you’re not taking someone else’s issue. For various reasons, someone could be already working on it, and I personally hate taking away someone’s issue.</li>
<li>It will make sure that you’re not going to waste your time and effort on something that’s outdated, unnecessary, unwanted, or already done. If any of these are true, a maintainer will most likely let you know.</li>
<li>It never hurts to be polite and communicate ?.</li>
</ol>
<p>After receiving a green light from a maintainer and the user that reported the issue, I went and applied a fix described in the issue. The fix itself wasn’t particularly mind blowing. Instead of checking for an installed version of yarn, it would check for the presence of a yarn.lock file instead. After some discussion on making the check slightly more elaborate and processing that feedback, they approved my changes. My PR was merged! ?</p>
<p>Did I feel super accomplished after this? You would expect so, but I actually felt way less excited about it than expected. Don’t get me wrong, it <strong>did</strong> feel satisfying to have my changes merged. It just didn’t feel like it was a super complex problem that I solved.</p>
<p>The real feeling of accomplishment and excitement actually came way later at unexpected moments. At multiple points in time, people would report certain problems that they had with Storybook. For me, those seemed completely unrelated to my changes. However, in at least 4 different issues, my fix was mentioned by a maintainer because it helped solve the issue at hand.</p>
<p>WHAT!? I ACTUALLY HELPED PEOPLE!? ? My small fix that felt like it was nothing actually helped people with their problems. The feeling of accomplishment and excitement that I had at that moment was indescribable. It exceeded any feeling that I could’ve had from solving a super complex problem of some kind. I still hold it very dear.</p>
<h4 id="heading-the-rest-of-the-week">The Rest of the Week</h4>
<p>After that moment, I felt even more motivation to keep working on issues and stuff in the project. As long as it was something that could help the users of Storybook, I was more than happy to have a go at it.</p>
<p>I paid more and more attention to the different activities in the repository. Whenever I found something I could do, I would politely ask whether it was okay for me to solve, and then make an attempt at solving it.</p>
<p>In my first week, I had opened 4 PR’s to Storybook, and all of them were accepted and merged! If you’re interested in the details on those PR’s, go ahead and <a target="_blank" href="https://github.com/storybooks/storybook/issues?q=author%3AKeraito+sort%3Acreated-asc">check out the GitHub tracker</a>.</p>
<p>I also want to go back briefly and further discuss the point that I made regarding watching the repositories and following all the activities in them. You might wonder whether it will pay off or be worth it for the required effort and time (which I agree is significant).</p>
<p>For me, the answer was a decisive yes, and this is why. My second PR had to do with a section of the codebase that I didn’t know and had never yet looked at. This, of course, was true for every part of the project as I was a new contributor. While I could find my way through the CLI code, this time it involved the actual Storybook application, which for me was on another level.</p>
<p>The main reason I was able to address the problem and work with the code anyway was because I went through the changes of someone else’s PR that touched upon that same part of the codebase. The style of my changes, if you compare it to the changes of that PR, were therefore very similar. But in the end, I still got the job done, and that’s all that mattered for me (and the project)!</p>
<p>But if I never took the time and effort to go through as much activity from the project as I could, including the work of others, I’m pretty sure I would’ve never been able to solve the issue (so quickly). So yes, if you’re serious about wanting to contribute to the project, then it’s definitely worth your time and effort.</p>
<h4 id="heading-what-i-learned">What I Learned</h4>
<p>To be honest, I haven’t really (yet) learned as much or improved as much in my programming this week as I expected. But don’t get me wrong — I’ve definitely learned some technical things, especially regarding how a significant project looks in practice.</p>
<p>Rather, I’ve learned a lot about working together with others. I’ve learned about communicating my thoughts and changes to the maintainers that had to review my changes. I’ve learned how to phrase my thoughts to get my ideas across.</p>
<p>In a way, this was the experience that I was looking for. Looking back onto this week, it has been super helpful. I’ve learned a lot, finally did something that I wanted to do for a long time, and, most important of all, <strong>I had fun!</strong></p>
<h4 id="heading-going-forward">Going Forward</h4>
<p>Going forward after this week and beyond, I will just do as I’ve done during this first week: keep an eye out on issues and conversations, and help wherever and whenever I can.</p>
<p>As time progresses, I hope be able to also contribute to more complex problems. Ideally, it would be super awesome for me to be able to contribute to something larger, like an additional feature or add-on to Storybook. Nonetheless, I enjoy what I’m doing, and will definitely stick around and continuing doing so.</p>
<p>As a matter of fact, I’ve stuck around so long that at the time that I’m finishing this post (~5 weeks after I started writing this) I was invited by the owner of Storybook to join the GitHub organization! ? I’m super grateful for this opportunity. I will definitely to try my best to make myself more and more useful to the project! ?</p>
<h4 id="heading-tldr">TLDR:</h4>
<ul>
<li>Think about what you want to accomplish with open source. If it’s not a long-term motivation, it will be hard to 1) get started and 2) keep going.</li>
<li>Watch all the activity from repositories that you’re interested in and try to spend time going through them. It will considerably increase your knowledge on the project and help you contribute.</li>
<li>Stay polite and have fun! ??</li>
</ul>
<p>Thank you for reading. If you enjoyed my story, consider clapping for it a bit, sharing it with other people, or following me either here or on <a target="_blank" href="https://twitter.com/keraito">Twitter</a> (or both ?). I will try my best to deliver similar content in the future!</p>
<p>If you have any feedback, either writing or content-wise, feel free to contact me in any of the described ways. I’m open to any feedback that will improve the quality and usefulness of my potential future content!</p>
<blockquote>
<p>Special thanks to <a target="_blank" href="https://www.freecodecamp.org/news/the-path-of-my-first-week-of-open-source-contributions-87823aaeb872/undefined">Maurício Aniche</a> and <a target="_blank" href="https://twitter.com/mjwsteenbergen">Martijn Steenbergen</a> for helping me out with this post through proofreading and feedback! Also to <a target="_blank" href="https://www.freecodecamp.org/news/the-path-of-my-first-week-of-open-source-contributions-87823aaeb872/undefined">Norbert de Langen</a> (Storybook’s maintainer), for inviting me to the GitHub org and trying his best to involve me in the project!</p>
</blockquote>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
