<?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 Hinam Mehra on Medium]]></title>
        <description><![CDATA[Stories by Hinam Mehra on Medium]]></description>
        <link>https://medium.com/@hinammehra?source=rss-f07ad4188b1a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*km5Q2Esq0Fcj825Z.jpg</url>
            <title>Stories by Hinam Mehra on Medium</title>
            <link>https://medium.com/@hinammehra?source=rss-f07ad4188b1a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 07:05:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hinammehra/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[Build a Material-UI React Component Library]]></title>
            <link>https://hinammehra.medium.com/build-a-material-ui-react-component-library-3e15a2d2841f?source=rss-f07ad4188b1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e15a2d2841f</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[material-ui]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reusable]]></category>
            <dc:creator><![CDATA[Hinam Mehra]]></dc:creator>
            <pubDate>Sat, 25 Sep 2021 13:23:40 GMT</pubDate>
            <atom:updated>2021-09-25T13:28:56.514Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re working in a small-ish engineering team, and you are lucky enough to not have super-opioniated designers, but unlucky enough to have to build multiple React Apps, I would highly recommend building Material-UI Component libraries.</p><p>These sets of libraries helped my team increase their development velocity 10-fold, and saved our brain cells from the endless copying + pasting every-time we brought onboard a new client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*m-f2bb_8_1cof0lk" /><figcaption>Photo by <a href="https://unsplash.com/@danielkcheung?utm_source=medium&amp;utm_medium=referral">Daniel Cheung</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Pre-requisites</h3><p>We’ve done already the heavy lifting so far:</p><ul><li>In <a href="https://hinammehra.medium.com/build-a-private-react-component-library-cra-rollup-material-ui-github-package-registry-1e14da93e790">Part I</a>, we created the foundation of our React Library, a <br>&lt;HelloWorld /&gt; component and a playground app to test our library as we go.</li><li>In <a href="https://hinammehra.medium.com/publish-a-private-react-component-library-part-ii-17e44f8a488e">Part II</a>, we published our library privately to the Github NPM Registry.</li></ul><h3>What we’ll build</h3><ul><li>In this part, we’ll use Material-UI (&amp; Formik) to create a more complex &lt;SignIn /&gt; component and add it our auth-component-library</li><li>We’ll make our component fully functional, add Auth-API + Context logic, so you’ll never have to write another SignIn page ever again (hopefully).</li></ul><h3>1. Install Material-UI</h3><ul><li>First, we will install Material-UI, Icons, Formik &amp; Yup (optional).</li><li>Building forms with Formik &amp; Yup is seamless, consistent, clean, but you are free to use any other library you wish. The process to add &amp; test them remains the same.</li></ul><pre>$ cd auth-component-library <br>$ npm i @material-ui/core @material-ui/icons formik yup</pre><ul><li>Then, we’ll move all the packages we just installed to the peerDepedencies array in our package.json and remove them from the dependencies.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5492a81c4f653b838a4c06827d8bf22f/href">https://medium.com/media/5492a81c4f653b838a4c06827d8bf22f/href</a></iframe><p><a href="https://medium.com/angular-in-depth/npm-peer-dependencies-f843f3ac4e7f">npm Peer Dependencies</a></p><h3>2. Create &lt;SignIn /&gt; Component</h3><ul><li>If you followed Part I, your auth-component-library’s folder structure should resemble this:</li></ul><pre>auth-component-library</pre><pre>   -- src/<br>       |-- components/<br>           |-- HelloWorld.js<br>       |-- index.js</pre><pre>   -- package.json</pre><ul><li>Next, we’ll create a SignIn.js file in the src/components folder. For now, we’ll create a compleletely <strong>presentational</strong> &lt;SignIn /&gt; component.</li><li>Our SignIn component uses Material UI + Formik to render the form, and Yup to create a validation schema.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da4575b9e310a7c8cc8c66686cf61cee/href">https://medium.com/media/da4575b9e310a7c8cc8c66686cf61cee/href</a></iframe><ul><li>Lastly, we’ll export our newly created component in our auth-component-library/index.js file.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/28cd85fb939fdececa036ab711f8a468/href">https://medium.com/media/28cd85fb939fdececa036ab711f8a468/href</a></iframe><h3>3. Test &lt;SignIn /&gt; Component in Playground</h3><ul><li>If you haven’t set-up a playground yet, you can follow <a href="https://hinammehra.medium.com/build-a-private-react-component-library-cra-rollup-material-ui-github-package-registry-1e14da93e790">Part I</a> to set-it up.</li><li>A playground allows you to easily test your components as you develop them. It can also act as a great way to create examples for your team.</li><li>We installed Material-UI &amp; other packages in our component-library, but we have yet to install it in our playground . To do this, we’ll just link to our Material-UI installation in our playground/package.json .</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4695a216f9d57168e8486ada9a21f4b3/href">https://medium.com/media/4695a216f9d57168e8486ada9a21f4b3/href</a></iframe><ul><li>And finally consume our &lt;SignIn /&gt; component in our playground/src/App.js .</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/edf515bac0c6b6abcc04f65ff68adb56/href">https://medium.com/media/edf515bac0c6b6abcc04f65ff68adb56/href</a></iframe><ul><li>Now, just run the following command and voila!</li></ul><pre>npm run dev</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*53jJbIqno0AIPg8cWWP4qQ.gif" /><figcaption>We are the Champions..of the Woooooorld</figcaption></figure><h3>4. Send Authentication request to the API</h3><p>For some use-cases, a purely presentational component might be enough. But, to make this &lt;SignIn /&gt; component fully-functional:</p><ul><li>We’ll create an AuthContext in our playground app. This will be used to store a JWT token that our Auth-API will send us, once a user is successfully authenticated.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/94f1ab985365bea2ffa4827ed713dd5b/href">https://medium.com/media/94f1ab985365bea2ffa4827ed713dd5b/href</a></iframe><ul><li>Next, we’ll just pass the context, an authUrl our &lt;SignIn /&gt; component in our playground/App.js.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91804dcc2add66810249433a4b6a8c28/href">https://medium.com/media/91804dcc2add66810249433a4b6a8c28/href</a></iframe><ul><li>We’ll finally submit the email &amp; password entered in our&lt;SignIn /&gt; component to the Auth-API, and store the access-token in the AuthContext</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b40d4ffb7283adba3e91d6f45f4ab26/href">https://medium.com/media/8b40d4ffb7283adba3e91d6f45f4ab26/href</a></iframe><h3>Final Thoughts</h3><ul><li>As I write this, Material UI has just released a v5 (very snazzy new website, I must say). While I haven’t had the chance to test it yet, if you do please let me know</li><li>The source code can be found on Github:</li></ul><p><a href="https://github.com/hinammehra/auth-component-library">GitHub - hinammehra/auth-component-library</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e15a2d2841f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Share your React Component Library (Privately)]]></title>
            <link>https://hinammehra.medium.com/publish-a-private-react-component-library-part-ii-17e44f8a488e?source=rss-f07ad4188b1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/17e44f8a488e</guid>
            <category><![CDATA[component-libraries]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Hinam Mehra]]></dc:creator>
            <pubDate>Thu, 28 Jan 2021 10:24:31 GMT</pubDate>
            <atom:updated>2021-09-25T13:31:54.233Z</atom:updated>
            <content:encoded><![CDATA[<p>In Part I, <a href="https://hinammehra.medium.com/build-a-private-react-component-library-cra-rollup-material-ui-github-package-registry-1e14da93e790">we created an auth-component-library</a> with our trusty <br>&lt;HelloWorld /&gt;component. In this post, we’ll publish our component libary to a private Github NPM Registry. This will allow the library to stay within your organisation and be consumable for all of your apps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W6jS36Ty4raICWtr" /><figcaption>Photo by <a href="https://unsplash.com/@dtopkin1?utm_source=medium&amp;utm_medium=referral">Dayne Topkin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>1. Create a Personal Access Token</h3><p>First, we are going to a <a href="https://github.com/settings/tokens">Create a Personal Access Token</a> within Github to read and write your packages.</p><ol><li>You can do this by going to:</li></ol><pre>Github Account -&gt; Settings -&gt; Developer Settings -&gt; <br>Personal Access Tokens -&gt; Generate New Token</pre><pre>Note: Private NPM Packages<br>Select scopes: write:packages, read:packages</pre><p>2. Click on <strong>Generate Token, and copy the token to the Clipboard.</strong></p><p>3. With the token copied, in the same directory as your package.json file, create an .npmrc file and add the following line, replacing <em>TOKEN</em> with your personal access token.</p><pre>//npm.pkg.github.com/:_authToken={<em>TOKEN}</em></pre><h3>2. Create a Private Repository in Github</h3><p>Create a <strong>Private</strong> repository in Github, just like you would normally and copy the URL. Mine would be:</p><pre>git://github.com/hinammehra/auth-component-library</pre><h3>3. Add publish-config to package.json</h3><p>To successfully publish, you need to make some small changes to your package.json.</p><ul><li>So far, your package.json should have your folder’s name, <br>&quot;name&quot;: &quot;auth-component-library&quot; . In order to publish your package, you need to rename it to@owner/repo-name. In my case that’s<br>&quot;name&quot;: &quot;@hinammehra/auth-component-library&quot;.</li><li>&quot;files&quot; : The folder with our generated library, i.e. the ./dist folder.</li><li>&quot;publishConfig&quot; : The registry where you want the package published, which is &quot;registry&quot;: &quot;https://npm.pkg.github.com&quot; .</li><li>&quot;repository&quot; : URL of the <strong>private</strong> Github repository we just created.</li><li>Lastly, if you have the following line in package.json, remove it. Setting <br>&quot;private&quot;: true in your package.json prevents it from being published at all. Don’t worry, your package will still be published as a private component library without it.</li></ul><pre>{<br>    ...<br>    &quot;private&quot;: true  // remove this line<br>    ...<br>}</pre><p>Ultimately, your <strong>package.json</strong> should look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47b4db1bd2ea2f24abe16cbeae29d0b2/href">https://medium.com/media/47b4db1bd2ea2f24abe16cbeae29d0b2/href</a></iframe><h3>3. Publish to Github Registry</h3><p>Try to publish your library with the following command and it should be a success!</p><pre>$ npm publish</pre><p>Your package is now visible on Github on:</p><pre>https://github.com/&lt;owner&gt;/&lt;repo-name&gt;/packages</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KcmqIBnpxyZQukgcmojKyw.png" /><figcaption>Ta-da!</figcaption></figure><h3>4. Consuming private component library</h3><p>With our private component library published, let’s try to consume it in a React App.</p><pre>$ create-react-app auth-consumer-app</pre><ul><li>Create another .npmrc in your consumer app and adding the following lines.</li><li>For simplicity, my TOKEN is same as Step 1, you should create another Personal Access Token with just <strong>read:packages</strong> privileges.</li><li>OWNER is your package’s owner, mine is hinammehra .</li></ul><pre>//npm.pkg.github.com/:_authToken={<em>TOKEN}<br></em>registry=https://npm.pkg.github.com/{OWNER}</pre><p>That’s it!</p><p>Now, try to run the installation command:</p><pre>$ npm install @OWNER/repo-name</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/33b4a296aa2ef1fa70eca1434c78dd82/href">https://medium.com/media/33b4a296aa2ef1fa70eca1434c78dd82/href</a></iframe><h3>Wrapping-Up..</h3><p><a href="https://github.com/hinammehra/auth-consumer-app#readme">GitHub - hinammehra/auth-consumer-app</a></p><ul><li>That’s it for Part II. <a href="https://docs.github.com/en/packages/guides/configuring-npm-for-use-with-github-packages">Github themselves have a pretty neat doco</a>, you can refer to that as well.</li><li>In <a href="https://hinammehra.medium.com/build-a-material-ui-react-component-library-3e15a2d2841f">Part III</a>, we’ll use Material UI to add a &lt;SignIn /&gt; component to our private library.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17e44f8a488e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a React Component Library]]></title>
            <link>https://hinammehra.medium.com/build-a-private-react-component-library-cra-rollup-material-ui-github-package-registry-1e14da93e790?source=rss-f07ad4188b1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e14da93e790</guid>
            <category><![CDATA[library-design]]></category>
            <category><![CDATA[material-ui]]></category>
            <category><![CDATA[rollup]]></category>
            <category><![CDATA[reusable]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Hinam Mehra]]></dc:creator>
            <pubDate>Wed, 01 Jul 2020 13:31:00 GMT</pubDate>
            <atom:updated>2021-09-25T13:29:37.444Z</atom:updated>
            <content:encoded><![CDATA[<p>I have always liked the idea of building code as lego-blocks — re-usable, modular, simple on their own but capable of great things when they come together.</p><p>In this 4-part series, we are going to focus on building a shared <strong>Auth Component Library</strong> that can be (privately) published and consumed by your entire team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ig8G2UZOMUfPhota" /><figcaption>Photo by <a href="https://unsplash.com/@lh1me?utm_source=medium&amp;utm_medium=referral">HONG LIN</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Thoughts on create-react-library?</h3><p>I tried it, I spent a week trying to figure it out and although a great package to start trying this idea out, I felt like it was a truck compared to the sports car I wanted and it really slowed down development (I couldn’t use the shorthand for fragments for some reason!). Plus, it’s not being actively maintained anymore which was a hard pass for me.</p><h4>Github</h4><p>If you’d like to skip to the end, here’s the github-repo:</p><p><a href="https://github.com/hinammehra/auth-component-library/blob/master/README.md">auth-component-library/README.md at master · hinammehra/auth-component-library</a></p><h3>Objective</h3><p>In this tutorial, we are just going to set-up the foundations of our component library with a <strong>HelloWorld</strong> component.</p><h3>1. Setting up the project</h3><p>In a directory of your choice, create a simple react app:</p><pre>$ npx create-react-app auth-component-library</pre><h3>2. Create a HelloWorld Component</h3><ol><li>Create a src/components folder and create a HelloWorld.js file inside it.(Optional: delete the public folder and all the other files inside the src folder)</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a66248f89903fcd80b5790cb9e48590e/href">https://medium.com/media/a66248f89903fcd80b5790cb9e48590e/href</a></iframe><p>2. Create an index.js file inside the src folder and export the component we just created. <strong>index.js file will be our key file</strong> throughout this process, exporting all the components we will create inside the components folder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/627826967b6e9d9f6d679227ad26e949/href">https://medium.com/media/627826967b6e9d9f6d679227ad26e949/href</a></iframe><p>5. The folder structure should now look like this:</p><pre>..<br>-- src/<br>   |-- components/<br>       |-- HelloWorld.js<br>   |-- index.js</pre><pre>-- package.json</pre><h3>3. Configure Rollup.js &amp; Babel to Build Our Library</h3><p>We have the first component of our library good to go. Now, to build our library, we need to install Rollup.js, Babel and other packages we require to bundle our library.</p><ol><li>We will be installing the following packages:</li></ol><pre>$ cd auth-component-library</pre><pre>$ npm i -D @babel/cli @babel/core @babel/preset-env @babel/preset-react rollup @rollup/plugin-babel rollup-plugin-delete rollup-plugin-peer-deps-external npm-run-all</pre><p>2. Next, create a .babelrc file in the root folder. It should look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/485394754c40486d4c9f0f809c0a6f09/href">https://medium.com/media/485394754c40486d4c9f0f809c0a6f09/href</a></iframe><p>3. Next, create a rollup.config.js file in the root folder. It should look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c0aead38e6001a02f783ff1a0edb9d6/href">https://medium.com/media/7c0aead38e6001a02f783ff1a0edb9d6/href</a></iframe><p>This is what each configuration field stands for:</p><ul><li><strong>input</strong>: The entry point to the component(s) we want to bundle. We directly point this to our src/index.js which we have used to export our components.</li><li><strong>output</strong>: This specifies the directory where you want to save the bundled library. We are importing the output paths from package.json (More about this in the next step), which we will specify as the ./dist folder.</li><li><strong>plugins</strong>: This specifies all the plugins you wish to use and their respective configurations. For instance, external is asking rollup to exclude peerDependencies as part of the bundle as they will be imported separately by the app calling this package. We will also configure peerDependencies in the next step.</li></ul><p>The folder structure at the end of this step should look like this:</p><pre>-- src/<br>   |-- components/<br>       |-- HelloWorld.js<br>   |-- index.js</pre><pre>-- .babelrc<br>-- rollup.config.js<br>-- package.json<br></pre><h3>4. Configure package.json</h3><ol><li>Add source, main &amp; module values in package.json for our rollup.config.js</li></ol><pre>{<br>    &quot;name&quot;: &quot;auth-component-library&quot;,<br>    &quot;version&quot;: &quot;0.1.0&quot;,<br>    &quot;private&quot;: true,<br>    &quot;main&quot;: &quot;dist/index.cjs.js&quot;,<br>    &quot;module&quot;: &quot;dist/index.esm.js&quot;,<br>    &quot;source&quot;: &quot;src/index.js&quot;,<br>  ...<br>}</pre><p>2. Add react, react-dom to peerDependencies and remove them from dependencies .</p><pre>{</pre><pre>    &quot;dependencies&quot;: {<br>        &quot;@testing-library/jest-dom&quot;: &quot;^4.2.4&quot;,<br>        &quot;@testing-library/react&quot;: &quot;^9.5.0&quot;,<br>        &quot;@testing-library/user-event&quot;: &quot;^7.2.1&quot;,<br>        &quot;react-scripts&quot;: &quot;3.4.3&quot;<br>    },</pre><pre>    &quot;devDependencies&quot;: {<br>        &quot;@babel/cli&quot;: &quot;^7.10.5&quot;,<br>        &quot;@babel/core&quot;: &quot;^7.11.4&quot;,<br>        &quot;@babel/preset-env&quot;: &quot;^7.11.0&quot;,<br>        &quot;@babel/preset-react&quot;: &quot;^7.10.4&quot;,<br>        &quot;@rollup/plugin-babel&quot;: &quot;^5.2.0&quot;,<br>        &quot;rollup&quot;: &quot;^2.26.4&quot;,<br>        &quot;rollup-plugin-delete&quot;: &quot;^2.0.0&quot;,<br>        &quot;rollup-plugin-peer-deps-external&quot;: &quot;^2.2.3&quot;<br>    },</pre><pre>    &quot;peerDependencies&quot;: {<br>        <strong>&quot;react&quot;: &quot;^16.13.1&quot;,<br>        &quot;react-dom&quot;: &quot;^16.13.1&quot;</strong><br>    },<br>}</pre><p>3. Add scripts (to make our lives a bit easier)</p><p>Lastly, we need to add two scripts to our package.json which will compile the components into a bundle using the configurations in rollup.config.js . Don’t worry about the playground scripts, just add them, they’ll make more sense in the next step when we set up our “Testing Playground”.</p><pre>{<br>  ...<br>    &quot;scripts&quot;: {<br>      &quot;build&quot;: &quot;rollup -c&quot;,<br>      &quot;build-watch&quot;: &quot;rollup -c -w&quot;, <br>      &quot;start-playground&quot;: &quot;cd playground &amp;&amp; npm run start&quot;,<br>      &quot;i-all&quot;: &quot;npm i &amp;&amp; cd playground &amp;&amp; npm i&quot;,<br>      &quot;dev&quot;: &quot;npm-run-all --parallel build-watch start-playground&quot;</pre><pre>    },<br>  ...<br>}</pre><p>4. The new package.json should look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/36cd0c504736ed7b9c407cdcd48450a0/href">https://medium.com/media/36cd0c504736ed7b9c407cdcd48450a0/href</a></iframe><p>5. Let’s build our library!</p><p>Now, run the following commands:</p><pre>$ npm update &amp;&amp; npm run build</pre><p>You should have a ./dist folder with two bundled files in it, index.cs.js and index.esm.js</p><blockquote>You have successfully created a component library! Now, we build our Testing Playground.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*BLSu1Il0IWEcrSVbxv_tOg.gif" /></figure><h3>5. Add a Testing Playground to Our Project</h3><p>We are now going to create a “playground” in our app so we can test our components as we develop them.</p><ol><li>For this, we are going to create another react app, this time inside the app we have already created.</li></ol><pre>$ cd auth-component-library<br>$ npx create-react-app playground</pre><p>2. Add the auth component library you just created as a dependency in playground/package.json . Also make sure to link react and react-dom to the already installed packages. Without this, it will give you “Invalid Hook Call” error when we start adding more complex components.</p><pre>{<br>    &quot;name&quot;: &quot;playground&quot;,<br>    &quot;version&quot;: &quot;0.1.0&quot;,<br>    &quot;private&quot;: true,<br>    &quot;dependencies&quot;: {<br>        &quot;@testing-library/jest-dom&quot;: &quot;^4.2.4&quot;,<br>        &quot;@testing-library/react&quot;: &quot;^9.5.0&quot;,<br>        &quot;@testing-library/user-event&quot;: &quot;^7.2.1&quot;,<br>       <strong> &quot;auth-component-library&quot;: &quot;file:..&quot;, <br>        &quot;react&quot;: &quot;file:../node_modules/react&quot;,<br>        &quot;react-dom&quot;: &quot;file:../node_modules/react&quot;,   <br>        &quot;react-scripts&quot;: &quot;file:../node_modules/react-scripts&quot;</strong> <br>    },<br>    ...</pre><pre>}</pre><p>3. Modify playground/src/App.js to call the &lt;HelloWorld /&gt; component</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93959513c8ef3ad369cec6064120849e/href">https://medium.com/media/93959513c8ef3ad369cec6064120849e/href</a></iframe><p>4. Run the playground app:</p><pre>$ npm run i-all<br>$ npm run dev</pre><p>This will build our library, watch for modifications, and run the Playground App at <a href="http://localhost:3000./">http://localhost:3000</a> . You should now see “Hello World” on your screen in giant letters. It’s a small but meaningful victory!</p><p>You can also modify the &lt;HelloWorld /&gt; component and your screen should update automatically.</p><h4>Next Steps:</h4><ul><li>In <a href="https://hinammehra.medium.com/publish-a-private-react-component-library-part-ii-17e44f8a488e?source=your_stories_page-------------------------------------">Part II</a>, we publish our shared component library in a private Github Respository so it can be easily shared across the team.</li><li>In <a href="https://hinammehra.medium.com/build-a-material-ui-react-component-library-3e15a2d2841f">Part III</a>, we add complex Material UI components to our library, such as fully-functional&lt;SignIn /&gt; component.</li><li>In Part IV, we add a mock JSON-API to our playground, to make sure our components will consume production Rest APIs properly.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e14da93e790" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>