<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Josh Kuttler on Medium]]></title>
        <description><![CDATA[Stories by Josh Kuttler on Medium]]></description>
        <link>https://medium.com/@josh_kuttler?source=rss-b1c5c37aa291------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*918JWWO9G1tFnqLzUqBPyA.jpeg</url>
            <title>Stories by Josh Kuttler on Medium</title>
            <link>https://medium.com/@josh_kuttler?source=rss-b1c5c37aa291------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 18:21:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@josh_kuttler/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Publish React Native Components for Reuse]]></title>
            <link>https://medium.com/bitsrc/how-to-publish-react-native-components-6deccfcf5a0d?source=rss-b1c5c37aa291------2</link>
            <guid isPermaLink="false">https://medium.com/p/6deccfcf5a0d</guid>
            <category><![CDATA[bit]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Josh Kuttler]]></dc:creator>
            <pubDate>Thu, 04 Jun 2020 16:54:00 GMT</pubDate>
            <atom:updated>2020-06-07T07:54:17.552Z</atom:updated>
            <content:encoded><![CDATA[<h4>Publishing and reusing React Native components across applications with Bit.</h4><figure><a href="https://bit.dev/"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*onuKAwAHdvT3zHQkdJodlg.jpeg" /></a></figure><p>React Native components, just like ReactJS, are built for reuse.</p><p>Reusing React native components across applications speeds up your development, makes it easier to maintain your codebase, and makes sure that your users will enjoy a consistent experience at every touchpoint.</p><p>However, publishing many components for reuse can also be a challenge that requires a lot of work, documentation, and teamwork. This work can be streamlined, simplified, and scaled using new tools built for this purpose.</p><p><a href="https://github.com/teambit/bit"><strong>Bit</strong></a> is a tool that helps you develop, publish and manage components across many applications. It is completed by the <a href="https://bit.dev/">bit.dev platform</a>, where all your components are organized, documented, and become available to reuse. It streamlines the process of publishing and documenting JS components.</p><figure><a href="https://bit.dev/"><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Nj2EzGOskF51B5AKuR-szw.gif" /></a><figcaption>Example: Exploring React components published on <a href="https://bit.dev/">Bit</a></figcaption></figure><p>In this post, I’ll show how to use <a href="https://bit.dev/"><strong>Bit</strong></a> to <em>independently</em> version, publish, and document React Native components from, essentially, any React Native app.</p><p>My published components will then be available on a public collection on <a href="https://bit.dev/">Bit.dev</a>, where others can read their docs, try them in a live playground, and install them using NPM, Yarn, or Bit. This collection can be gradually expanded to create a fully functional reusable system of components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*UQXdMRP4ygpd6QAC9A_j9g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nzH8a6ZOtuhA0GDGU2vSsQ.png" /><figcaption>The <a href="https://github.com/JoshK2/mystore">“My Store” app</a> and its <a href="https://bit.dev/joshk/mystore-app-components">published components</a></figcaption></figure><h3>Building a React Native Store App: “My Store”</h3><p>Demo project on GitHub:</p><p><a href="https://github.com/JoshK2/mystore">JoshK2/mystore</a></p><pre>$ npx react-native init mystore</pre><p>Any store needs some way to present its products. To make that happen, I’ll create 3 components:</p><ul><li>Product: Shows the image, title, description and price.</li><li>Button: Adds the product to the shopping cart.</li><li>Products list: Receive a list of products and displays them vertically.</li></ul><pre>src<br>└── components<br>    ├── button.js<br>    ├── product.js<br>    └── products-list.js</pre><p>For example, the “Button” component:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a398dcd61808ef32c36e10cfe6471cb4/href">https://medium.com/media/a398dcd61808ef32c36e10cfe6471cb4/href</a></iframe><p>I’ve used prop-types for all my components. That will serve two purposes:</p><ol><li>As with any other use of prop-types, my components will be safer to use.</li><li>Bit will use my prop-types definitions to create documentation for each component. That would also be the case with TypeScipt and JSDocs (alternatively, you can add an .md file to your component).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*Mihz5IQf81PGgMjuscsm0w.png" /></figure><h3>Publishing the “My Store” Components to Bit</h3><ol><li>Install Bit globally.</li></ol><pre>npm install bit-bin --global</pre><p>2. Initialize a new “Bit Workspace” (in the project’s root directory).</p><pre>$ bit init</pre><p>3. Track all components under the components directory (similar to git add ). While doing this, Bit will automatically define each unit as a “component” with all its relevant files, dependencies etc. This is very useful when you seek to develop and publish many components in the same repository.</p><pre>$ bit add src/components/*</pre><p>4. Configure my tracked components to use the <a href="https://bit.dev/bit/envs/compilers/react-native">React Native compiler</a> available in Bit’s <a href="https://bit.dev/bit/envs">“ENVs” collection</a>.</p><p>Wit hBit, we configure a compiler to decouple the soon-to-be-published components from the app’s build setup. This way, we make sure they’ll work in other future environments.</p><p>That’s done by importing the compiler as I would with any other published component and adding the -c flag to set it as a compiler (this will be added to Bit’s configurations in package.json )</p><pre>$ bit import bit.envs/compilers/react-native -c</pre><p>5. Bit lets you version each component independently, which is <a href="https://blog.bitsrc.io/versioning-independent-ui-components-why-and-how-7ea60d8be5f2">great for reuse at a slightly larger scale</a>. Tag all components to record all changes and lock versions. The -a flag marks all tracked components. We could also specify the new version number but, here, I’ve left that to Bit.</p><pre>$ bit tag -a</pre><p>Now if you run bit status, you’ll see that each component got its own version. Remember that Bit tracks every component’s dependencies as well as changes to its code, so from now on when you make a change, Bit will help you tag and bump the version of all components impacted by the change.</p><p>6. Publish all tracked components.</p><p>For this, I’ll first head over to <a href="https://bit.dev/">Bit.dev</a>, open a free account, and create a new component collection. I’ll name this collection “mystore-app-components”. Once done, I’ll continue to publish them to my new collection.</p><pre>$ bit export joshk.mystore-app-components</pre><p><strong>My components are now published on Bit! 🎉</strong></p><p><a href="https://bit.dev/joshk/mystore-app-components">mystore-app-components by joshk · Bit</a></p><figure><a href="https://bit.dev/joshk/mystore-app-components"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5wA3uXU7pFW_fty-lVZ8Ig.png" /></a><figcaption><a href="https://bit.dev/joshk/mystore-app-components">https://bit.dev/joshk/mystore-app-components</a></figcaption></figure><p>All my components are now reusable, and I can share them between the different applications that I or my team are building.</p><p>You can browse through the component pages, see each component rendered in Bit’splayground (using an example code I’ve written).</p><p>You can choose to either <strong>install</strong> components like any other package using NPM/Yarn or to “clone” components into your project using bit import .</p><p><strong>Imported</strong> or “cloned” components (`bit import`) can be modified in any codebase using them and pushed back with a bumped version. That makes collaboration possible even across repositories.</p><p>Happy coding and sharing!</p><h3>Learn More</h3><ul><li><a href="https://blog.bitsrc.io/building-with-react-for-all-platforms-5-top-frameworks-and-tools-affd5baf3de3">Building with React for All Platforms: Top Frameworks and Tools</a></li><li><a href="https://blog.bitsrc.io/building-a-react-component-design-system-8b643bb8922b">Building a React Design System</a></li><li><a href="https://blog.bitsrc.io/state-of-micro-frontends-9c0c604ed13a">The State of Micro Frontends</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6deccfcf5a0d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitsrc/how-to-publish-react-native-components-6deccfcf5a0d">How to Publish React Native Components for Reuse</a> was originally published in <a href="https://medium.com/bitsrc">Bits and Pieces</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Created My Own React Spinners Library]]></title>
            <link>https://medium.com/@josh_kuttler/how-i-created-my-own-react-spinners-library-d54a8c675300?source=rss-b1c5c37aa291------2</link>
            <guid isPermaLink="false">https://medium.com/p/d54a8c675300</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Josh Kuttler]]></dc:creator>
            <pubDate>Tue, 03 Sep 2019 15:08:38 GMT</pubDate>
            <atom:updated>2019-09-04T19:11:35.864Z</atom:updated>
            <content:encoded><![CDATA[<figure><a href="https://bit.dev/joshk/react-spinners-css"><img alt="" src="https://cdn-images-1.medium.com/max/808/1*NKjxo9UOvPYUc_syH-Idkw.gif" /></a><figcaption><a href="https://bit.dev/joshk/react-spinners-css">https://bit.dev/joshk/react-spinners-css</a></figcaption></figure><p>I’ve created an application that uses Airtable as a database. I’ve used a spinner to take the place of a dull blank page which would otherwise be presented to the user in the time that it takes for the requested data to arrive and for the page to get rendered accordingly.</p><p>I could have used an existing react spinners library, but instead, I decided to use this chance to learn how to build my own spinners and my own React component library. So, in this post, I’ll show you my library, and an example of how to use a spinner.</p><h3><a href="https://bit.dev/joshk/react-spinners-css">React Spinners Library</a></h3><p>So, without further ado, here’s my react spinners library (<a href="https://github.com/JoshK2/react-spinners-css">GitHub</a>, <a href="https://bit.dev/joshk/react-spinners-css">Bit</a>). It’s based on loading.io CSS loaders. I’ve added the option to send color and size as props of the component so that it’s easier to customize the spinners. I’ve exported the spinners (twelve in total) to <a href="https://bit.dev/joshk/react-spinners-css">bit.dev</a> so you may easily view and tweak them in Bit’s live playground, and install them as packages with NPM or Yarn (or get their source code using Bit import).</p><p><a href="https://github.com/JoshK2/react-spinners-css">JoshK2/react-spinners-css</a></p><p>For example, this is the circle loader and the component can receive color and size props:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db6b9691d6164e694af3d435a808377f/href">https://medium.com/media/db6b9691d6164e694af3d435a808377f/href</a></iframe><p>and the code import a very simple CSS code, exactly the same from loading.io CSS loader:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8e7dce1db0ea5986faefe097c779f7a/href">https://medium.com/media/c8e7dce1db0ea5986faefe097c779f7a/href</a></iframe><h3>How to use Loader animation in your React.js application?</h3><p>So, you have a component that sends a request and stores the received data in an array inside your state object. The obvious thing to do is check if the array is empty and if so, display the spinner.</p><p>For this example, I used a <a href="https://bit.dev/joshk/react-spinners-css/facebook">Facebook spinner</a> with a very simple page that waiting 5 seconds until to show a list of cars.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8a058baab5e463a5bb27a05f30f45e4/href">https://medium.com/media/f8a058baab5e463a5bb27a05f30f45e4/href</a></iframe><p>It’s very simple to use and allows you to show a nice animation loader until the data is loaded.</p><p>Also, you can use a custom color in any spinner, just send a color inside the color property, like this:</p><pre>&lt;Facebook color=&quot;red&quot; /&gt;<br>&lt;Facebook color=&quot;#cecece&quot; /&gt;</pre><p>Or be crazy and use a random color with my <a href="https://bit.dev/joshk/jotils/get-random-color">random color generator component</a>.</p><pre>&lt;Facebook color={getRandomColor()} /&gt;</pre><p>You can see the result with random color in this live demo <a href="https://bit.dev/joshk/react-spinners-css/facebook?example=5d6bc96a93fdc2001a39ab1d">facebook react spinner</a>.</p><p>If you want to see more react spinners examples, check out my react spinners components collection in <a href="https://bit.dev/joshk/react-spinners-css">bit.dev</a>.</p><p>For any issue or missing features, please open an issue on <a href="https://github.com/JoshK2/react-spinners-css">GitHub</a> and I’ll do my best.</p><p>And of course, if you like it, star it!</p><p><a href="https://github.com/JoshK2/react-spinners-css">JoshK2/react-spinners-css</a></p><p>And follow me on <a href="https://twitter.com/JoshKuttler">Twitter</a> to get features updates.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d54a8c675300" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Tic Tac Toe App with TypeScript, React and Mocha]]></title>
            <link>https://medium.com/bitsrc/build-a-tic-tac-toe-game-with-typescript-react-and-mocha-ce6f1e74c996?source=rss-b1c5c37aa291------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce6f1e74c996</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[wed-design]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Josh Kuttler]]></dc:creator>
            <pubDate>Mon, 20 May 2019 14:22:46 GMT</pubDate>
            <atom:updated>2019-05-21T11:30:01.870Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn how to compose a tic-tac-toe app with React and TypeScript components.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9C55x7B7mv86eILwKfmBJA.jpeg" /></figure><p>A simple Tic-Tac-Toe game built with modularity in mind and <a href="https://bit.dev/joshk/tic-tac-toe-game">shared on Bit</a>. After sharing, my game’s components can be tweaked and tested on Bit’s live PlayGround. <a href="https://bit.dev/joshk/tic-tac-toe-game">Go to my components collection</a> on Bit to test or consume the entire game or just some of its components, using NPM, Yarn or Bit.</p><p><a href="https://bit.dev/joshk/tic-tac-toe-game">tic-tac-toe-game by joshk · Bit</a></p><p>When building a game like Tic-Tac-Toe “with modularity in mind”, it&#39;s hard to think of a reason for the UI components to be reused ever again, so I kept my focus primarily on the game’s utility functions.</p><p>I chose TypeScript as my coding language of choice — compiled by B<a href="https://bit.dev/bit/envs/compilers/react-typescript">it’s TypeScript compiler</a> and used Mocha for testing.</p><p>To install components from my project, first configure <a href="https://bit.dev/">bit.dev</a> as a scoped registry (copy and paste to your terminal) — this is done only once! later uses of bit do not require you to configure again.</p><pre>npm config set &#39;@bit:registry&#39; <a href="https://node.bit.dev/">https://node.bit.dev</a></pre><p>and then install the component using Yarn or NPM:</p><pre>npm i <a href="http://twitter.com/bit/joshk">@bit/joshk</a>.tic-tac-toe-game.game<br>yarn add <a href="http://twitter.com/bit/joshk">@bit/joshk</a>.tic-tac-toe-game.game</pre><h3>Game Component</h3><p>The ‘game’ component is my app’s main component — composed using one component from ‘Board’ and two components from ‘<a href="https://bit.dev/primefaces/primereact">Prime React</a>’.</p><p>I used the <a href="https://bit.dev/primefaces/primereact/button">button</a> and the <a href="https://bit.dev/primefaces/primereact/inputtext">input-text</a> for the configuration screen — test and see the code <a href="https://bit.dev/joshk/tic-tac-toe-game/game/~code#Game/Game.tsx">here</a>.</p><figure><a href="https://bit.dev/joshk/tic-tac-toe-game/game"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_9F3CTTx6Gn8mMpqWZdv2w.jpeg" /></a></figure><ul><li><a href="https://bit.dev/primefaces/primereact/button">button - primereact · Bit</a></li><li><a href="https://bit.dev/primefaces/primereact/inputtext">inputtext - primereact · Bit</a></li></ul><p>Install PrimeReact components in your project:</p><pre>yarn add @bit/primefaces.primereact.inputtext<br>yarn add @bit/primefaces.primereact.button</pre><p>After setting the parameters, you can click ‘Play’ and… Play!</p><h3>Board Component</h3><p>The <a href="https://bit.dev/joshk/tic-tac-toe-game/board">board</a> component creates a dynamic table by props, manage player turn and check for the winner. Test and see the code <a href="https://bit.dev/joshk/tic-tac-toe-game/board/~code#Board/Board.tsx">here</a>.</p><figure><a href="https://bit.dev/joshk/tic-tac-toe-game/board"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8WrsQcJZFho4LUIXEO51_w.jpeg" /></a></figure><h3>Square Component</h3><p>The square component is a simple cell that receives value with optional color and sends an event to the board component when the value changes. Test and see the code <a href="https://bit.dev/joshk/tic-tac-toe-game/square/~code#Square.tsx">here</a>.</p><figure><a href="https://bit.dev/joshk/tic-tac-toe-game/square"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gZzWS8eCMyEUbdWYauEegA.jpeg" /></a></figure><h3>Empty cell function</h3><p>‘Empty cell function’ Is a helper <a href="https://bit.dev/joshk/tic-tac-toe-game/utils/have-empty-cell">function</a> to <a href="https://bit.dev/joshk/tic-tac-toe-game/utils/winner-calc">winner-calc function</a> that checks if there are any empty cells in the game’s table.</p><p>Bit lets you see the docs for the component and the results of the tests:</p><figure><a href="https://bit.dev/joshk/tic-tac-toe-game/utils/have-empty-cell"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wu-MLh7hczWOLELoZrw70A.jpeg" /></a></figure><p>The code of the function:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/16f0c83a2fe9f336c2b4961c2ef78223/href">https://medium.com/media/16f0c83a2fe9f336c2b4961c2ef78223/href</a></iframe><h3>Winner Calculation</h3><p><a href="https://bit.dev/joshk/tic-tac-toe-game/utils/winner-calc">Winner calculation</a> is a function that checks for the winner in horizontal, vertical and diagonal cases.</p><p>Bit let you see the docs for the component and the results of the tests:</p><figure><a href="https://bit.dev/joshk/tic-tac-toe-game/utils/winner-calc"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*45TDA5x-BCzqAqNdHUJprw.jpeg" /></a></figure><p>The code for the function:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f66bcc68b1c2b923d208017d38b23d35/href">https://medium.com/media/f66bcc68b1c2b923d208017d38b23d35/href</a></iframe><p>The project is available in my bit collection and in my GitHub repository:</p><ul><li><a href="https://bit.dev/joshk/tic-tac-toe-game">tic-tac-toe-game by joshk · Bit</a></li><li><a href="https://github.com/JoshK2/tic-tac-toe-game-using-bit">JoshK2/tic-tac-toe-game-using-bit</a></li></ul><p>Feel free to comment below and follow me on <a href="https://twitter.com/JoshKuttler">Twitter</a> 😃</p><h3>Learn More</h3><ul><li><a href="https://blog.bitsrc.io/5-tools-for-faster-development-in-react-676f134050f2">5 Tools for Faster Development in React</a></li><li><a href="https://blog.bitsrc.io/how-to-write-better-code-in-react-best-practices-b8ca87d462b0">How To Write Better Code in React</a></li><li><a href="https://blog.bitsrc.io/building-a-shared-ui-component-library-350b297a53a8">Building a Shared UI Component Library</a></li><li><a href="https://bit.dev/">Bit. Composable software.</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce6f1e74c996" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitsrc/build-a-tic-tac-toe-game-with-typescript-react-and-mocha-ce6f1e74c996">Build a Tic Tac Toe App with TypeScript, React and Mocha</a> was originally published in <a href="https://medium.com/bitsrc">Bits and Pieces</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Super-Modular Todo App with React and Bit Components]]></title>
            <link>https://medium.com/bitsrc/build-a-super-modular-todo-app-with-react-and-bit-components-aa06bbac4084?source=rss-b1c5c37aa291------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa06bbac4084</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[bit]]></category>
            <dc:creator><![CDATA[Josh Kuttler]]></dc:creator>
            <pubDate>Wed, 10 Apr 2019 15:10:07 GMT</pubDate>
            <atom:updated>2019-07-31T14:31:47.963Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to compose a highly modular React application with reusable components from 5 different libraries.</h4><figure><a href="https://bit.dev/joshk/basic-todo-app/todo-app"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4XJPGFQtX3EmP0ZZBG1w7Q.png" /></a><figcaption>The final todo app composition with Bit</figcaption></figure><p>Modular programming has been around since the 60s, and the term itself was set at 1968 by <a href="https://en.wikipedia.org/wiki/Larry_Constantine">Larry Constantine</a> and extended ever since.</p><p>Today, in the technological world of component-based libraries like <a href="https://github.com/facebook/react">React</a> and with tools like <a href="https://github.com/teambit/bit">Bit</a>, application modularity can be taken to a whole new level.</p><p>We will compose a simple React Todo application using reusable components from 5 popular libraries like <a href="https://bit.dev/mui-org/material-ui">Material-UI</a>, <a href="https://bit.dev/grommet/grommet">Grommet</a> and <a href="https://bit.dev/semantic-org/semantic-ui-react">Semantic-UI</a>. Thanks to Bit, we can quickly isolate and compose these components into an app.</p><p>When done, not only we will compose a highly-modular app from reusable components, but we will have a collection of components we can reuse to build more apps. The entire app is shared as a reusable component, which can be extended and composed with other components to build larger apps.</p><p>This is very exciting, as it’s a live implementation of full-blown modular application composition with a Lego-like experience.</p><p>This is the result of the todo list app:</p><figure><a href="https://bit.dev/joshk/basic-todo-app/todo-app"><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*cAylrEutkQWspFHEuR8ewg.png" /></a></figure><p>And here’s the app’s GitHub repo:</p><p><a href="https://github.com/JoshK2/basic-todo-app-using-bit">JoshK2/basic-todo-app-using-bit</a></p><h3>3 Components</h3><p>For creating the app I decided to divide the App’s code into 3 components:</p><ol><li><a href="https://bit.dev/joshk/basic-todo-app/todo-item">TodoItem component</a>, text with remove option.</li><li><a href="https://bit.dev/joshk/basic-todo-app/add-item">AddItem component</a>, input text area with add button and remove all button.</li><li><a href="https://bit.dev/joshk/basic-todo-app/todo-app">TodoApp component</a>, this is the main code of the app that includes the TodoItem and the AddItem, so there will be a List with simple code to manage all the components options like remove, remove all and add.</li></ol><p>Components 1+2 are modularly composed of components isolated and shared from different libraries- using <a href="https://github.com/teambit/bit">Bit</a> which helps us isolate, share and manage reusable components to build modular applications.</p><h3>TodoItem</h3><p>This component receives a simple text and id for removing the right todo item from the main list as props, and uses a remove icon from the <a href="https://bit.dev/semantic-org/semantic-ui-react">semantic-ui-react</a> component collection:</p><p><a href="https://bit.dev/semantic-org/semantic-ui-react/icon?example=5c920bc8c634f0001a931747">icon - semantic-ui-react · Bit</a></p><p>To install the component, firsy configure <a href="https://bit.dev/">bit.dev</a> as a scoped registry (one time action) and then install the component using Yarn:</p><pre>npm config set &#39;@bit:registry&#39; <a href="https://node.bit.dev/">https://node.bit.dev</a></pre><pre>yarn add @bit/semantic-org.semantic-ui-react.icon</pre><p>This is the code of the component, after adding some helping-code to show the remove icon and send remove as an event to the main component when remove is clicked.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c75f15dc44d4a89dc8484efb6f07bb2/href">https://medium.com/media/4c75f15dc44d4a89dc8484efb6f07bb2/href</a></iframe><p>Here’s the final TodoItem component with live editing and playground in Bit:</p><p><a href="https://bit.dev/joshk/basic-todo-app/todo-item">todo-item - basic-todo-app · Bit</a></p><h3>AddItem</h3><p>This component shows an input text area with auto resize and two buttons, one to add an item to the list, and the second to remove all items from the list. The remove all button work with props to show or hide this button.</p><p>So for this, I use input text area and button from <a href="https://bit.dev/primefaces/primereact">primereact</a>, a button from <a href="https://bit.dev/grommet/grommet">grommet</a>, and icon from <a href="https://bit.dev/grommet/grommet-icons">grommet-icons</a>.</p><ul><li><a href="https://bit.dev/primefaces/primereact/inputtextarea?example=5c7e8a95c2156c0014089509">inputtextarea - primereact · Bit</a></li><li><a href="https://bit.dev/primefaces/primereact/button">button - primereact · Bit</a></li><li><a href="https://bit.dev/grommet/grommet/button">button - grommet · Bit</a></li><li><a href="https://bit.dev/grommet/grommet-icons/add">add - grommet-icons · Bit</a></li></ul><p>Install it:</p><pre>yarn add @bit/primefaces.primereact.inputtextarea  <br>yarn add @bit/primefaces.primereact.button  <br>yarn add @bit/primefaces.primereact.internal.stylelinks  <br>yarn add @bit/grommet.grommet.button<br>yarn add @bit/grommet.grommet-icons.add</pre><p>This is the code of the component after adding some helping code to use the Add button and the Remove All button.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f134729bc345378f1960a321424756a/href">https://medium.com/media/1f134729bc345378f1960a321424756a/href</a></iframe><p>AddItem component with live editing and playground</p><p><a href="https://bit.dev/joshk/basic-todo-app/add-item">add-item - basic-todo-app · Bit</a></p><h3>TodoApp</h3><p>This component is the main component that uses the TodoItem and the AddItem components. The component has a list of item and allow to send an initial list as a prop, and receives all the event from the other components to manage the list. Like the add item, the remove item and the remove all item.</p><p>So I use List component from semantic-ui-react, and a unique id function from <a href="https://bit.dev/lodash/lodash">lodash</a> to avoid key error in map function.</p><ul><li><a href="https://bit.dev/semantic-org/semantic-ui-react/list?example=5c920bc8c634f0001a931828">list - semantic-ui-react · Bit</a></li><li><a href="https://bit.dev/lodash/lodash/unique-id">unique-id - lodash · Bit</a></li></ul><p>Install it:</p><pre>yarn add @bit/semantic-org.semantic-ui-react.list  <br>yarn add @bit/semantic-org.semantic-ui-react.internal.style-links<br>yarn add @bit/lodash.lodash.unique-id</pre><p>This is the main code of the app, it receives and manages all the events that come from AddItem and TodoItem components.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a19f456cde71a838a53ead300a467334/href">https://medium.com/media/a19f456cde71a838a53ead300a467334/href</a></iframe><p>Then all that’s left is to <a href="https://bit.dev/">export the components with Bit</a>- and the final TodoApp is now a modular and reusable component!</p><p><a href="https://bit.dev/joshk/basic-todo-app/todo-app">todo-app - basic-todo-app · Bit</a></p><p>All the reusable components we built are available in this collection, including the final todo app</p><p><a href="https://bit.dev/joshk/basic-todo-app">basic-todo-app by joshk · Bit</a></p><p>Check the GitHub repo to see all the project’s code:</p><p><a href="https://github.com/JoshK2/basic-todo-app-using-bit">JoshK2/basic-todo-app-using-bit</a></p><h3>Conclusion</h3><p>In this post, we’ve seen a very real example of modular software composition with reusable React components and Bit.</p><p>When we base our software design on modularity of <a href="https://addyosmani.com/first/">smaller focused components</a>, we build a better application which is easier to develop, maintain, test and extend. Today, building modular apps becomes more practical- and more fun- than ever before in history.</p><p>The same can be done not only with React and not only with frontEnd components. In my next posts, I’ll play with a modular composition for a verity of different technologies and architectures. Thanks for reading and feel free to ask anything! Cheers 🚀</p><h3>Learn more</h3><ul><li><a href="https://blog.bitsrc.io/how-to-easily-share-react-components-between-projects-3dd42149c09">How to Share React UI Components between Projects and Apps</a></li><li><a href="https://blog.bitsrc.io/simplify-complex-ui-by-implementing-the-atomic-design-in-react-with-bit-f4ad116ec8db">Atomic Design With React And Bit: Simplify a Complex UI</a></li><li><a href="https://blog.bitsrc.io/5-tools-for-faster-development-in-react-676f134050f2">5 Tools for Faster Development in React</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa06bbac4084" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitsrc/build-a-super-modular-todo-app-with-react-and-bit-components-aa06bbac4084">Build a Super-Modular Todo App with React and Bit Components</a> was originally published in <a href="https://medium.com/bitsrc">Bits and Pieces</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>