<?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 Deepanshu Madan on Medium]]></title>
        <description><![CDATA[Stories by Deepanshu Madan on Medium]]></description>
        <link>https://medium.com/@deepanshumadan?source=rss-7b2962d03fea------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*LAUkBqT2sTvGR-msjQuc7Q.png</url>
            <title>Stories by Deepanshu Madan on Medium</title>
            <link>https://medium.com/@deepanshumadan?source=rss-7b2962d03fea------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 14:04:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@deepanshumadan/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[Create scalable ReactJs web app in 10 minutes]]></title>
            <link>https://medium.com/@deepanshumadan/create-scalable-reactjs-web-app-in-10-minutes-e4d97828f997?source=rss-7b2962d03fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4d97828f997</guid>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[web-app-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Deepanshu Madan]]></dc:creator>
            <pubDate>Sun, 22 Sep 2019 19:05:05 GMT</pubDate>
            <atom:updated>2019-09-23T16:53:56.012Z</atom:updated>
            <content:encoded><![CDATA[<h3>Create scalable ReactJs web app in 10 minutes- for beginners</h3><h4>React has become very popular as a UI layer, but there doesn’t appear to be a clearly proven best practice for the state management.</h4><p>While Redux has become the most popular central state management solution, it’s often very verbose with a huge learning curve. In this post, we’ll explore a react + antd + umi + dva stack which makes it easy to create scalable web apps with cleaner architecture for data flow and state management.</p><p>Ant Design for React is a UI library that contains a set of high quality components for building rich, interactive user interfaces.</p><p>In real project development, you need a data flow solution like Redux or MobX. Ant Design React can also be used with any data flow solution and application framework within the React ecosystem. They have launched dva based on Redux, as well as a pluggable enterprise application framework umi, which is recommended for use in your projects.</p><p><strong>Dva</strong> is a lightweight data flow solution based on Redux. The concept comes from elm. It supports side effects, hot module replacement, dynamic loading, react-native, SSR, etc. It has been widely used in production.</p><p>And <strong>umi</strong> is a routing-based framework that supports next.js-like conventional routing and various advanced routing functions, such as routing-level on-demand loading. With a complete plugin system that covers every life cycle from source code to build product, umi is able to support various functional extensions and business needs.</p><p>Let’s create our web app using Ant design React with dva and um.</p><ol><li>Create umi env</li></ol><pre>$ npm create umi</pre><p>2. Choose app</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/0*X1Vd1ZWCxLGUUd5_" /></figure><p>3. Select no to use typescript</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/0*_5j-r7kdeaIGivCt" /></figure><p>When to use Typescript? If you are working on a project which you are going to maintain for long-term, you should use TypeScript from day 1. You get features like type hinting, code completion, intel about apis and packages, etc. but there are cons like: issues with third party type library definitions, boilerplate, etc.</p><p>4. Select antd and dva</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*F1g0qaBXjUktN4ET" /></figure><p>5. Success!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/0*zt5Zn0GBjBrgIahE" /></figure><p>6. Install dependencies:</p><pre>$ npm install</pre><p>7. Start your app now:</p><pre>$ npm start</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/0*gh3PI4eZRvFLSuDu" /></figure><p>8. Congrats! you got your app running</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EonxqdKEo4_0032Z" /></figure><p>9. check the configuration in .umirc.js, you should have antd turned on</p><p>10. We will to write an application displaying the list of to-do items. The first step is to create a route.</p><p>Inside the project directory, do:</p><pre>$ npx umi g page todo</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/0*NnzJqTU58Vsmm3TL" /></figure><p>11. Then open <a href="http://localhost:8001/todo">http://localhost:8001/todo</a> in your browser and you should see the corresponding page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VX5MZqg40OwUFxiK" /></figure><p>12. Now we’ll create a TodoList component that we can used to show a list of TODO items. We will use antd <a href="https://ant.design/components/table/">Table</a> component to show a table with todo items and a different column to mark items done using a <a href="https://ant.design/components/popconfirm/">PopConfirm</a> dialog, another antd component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/0*hQ61fBczbhY55DK6" /></figure><p>13. dva manages the domain model with model, with reducers for synchronous state updates, effects for async logic, and subscriptions for data source subscribe.</p><p>Let’s create a model <em>src/models/todo.js</em> by typing,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/0*Mo_PJKH0yhowz7Bh" /></figure><p>In this model:</p><ul><li><strong>namespace</strong> represents the key on global state</li><li><strong>state</strong> is the initial value, here it is an empty array</li><li><strong>reducers</strong> is equivalent to a reducer in redux, accepting an action, and update state simultaneously, here we are removing the todo item when done.</li></ul><p><strong>In umi, the model files under src/models will be automatically injected, you don’t need to inject manually.</strong></p><p>14. So far, we have completed a separate <strong>model</strong> and <strong>component</strong>. How do we connect them together? dva provides a connect method. If you are familiar with redux, this connect is from react-redux.</p><p>We put the Todolist <strong>component</strong> we created with a Table, inside our page todo.js and connect it with the todos <strong>model</strong> we created in the step above.</p><p>Edit src/pages/todo.js and replace it with the following,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/0*zWGrAUOYjhqbrtEN" /></figure><p>15. For now we will add some dummy data to make the app run and show some content for the Todolist table of todo items. Edit src/app.js,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/0*fdoblSYaQI6PuLzf" /></figure><p>16. Run the app!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*Nk2JAAlesC5OwozwnCSOCQ.gif" /></figure><p>In the next post, we will learn how to connect the web app you just created ,to an external datasource on AWS, where we’ll store the todo items in a dynamoDB database and access it using AppSync GraphQL APIs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4d97828f997" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>