<?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 IMRAN AHMED on Medium]]></title>
        <description><![CDATA[Stories by IMRAN AHMED on Medium]]></description>
        <link>https://medium.com/@imran44?source=rss-1ac3a3594e81------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*aACu_AT5VGsrq7wJL-tw3g.jpeg</url>
            <title>Stories by IMRAN AHMED on Medium</title>
            <link>https://medium.com/@imran44?source=rss-1ac3a3594e81------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 23:29:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@imran44/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[Learning Redux, What about I know about Redux (React)]]></title>
            <link>https://medium.com/@imran44/learning-redux-what-about-i-know-about-redux-react-886eecf4406?source=rss-1ac3a3594e81------2</link>
            <guid isPermaLink="false">https://medium.com/p/886eecf4406</guid>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[reducer]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-redux]]></category>
            <dc:creator><![CDATA[IMRAN AHMED]]></dc:creator>
            <pubDate>Tue, 11 Jan 2022 16:38:05 GMT</pubDate>
            <atom:updated>2022-01-11T16:38:05.164Z</atom:updated>
            <content:encoded><![CDATA[<p>Redux is a client-side state management system. In large-scale web applications, it is most popular. I explain how to implement and use Redux as a beginner.</p><p>To make a shop, you must first store all products, then sell or import products, the third operator or provider who delivers every product based on client query. In-store we keep our all-state when we need any data; this store provides data. A store is a global place, and everyone uses them.</p><p>Then come to Action, we think it on shop second options where import or sell products based on client query. In redux, we make here a list of what to do here. Action is a just list of what and how we operate it.</p><p>Lastly, come reducer, we have store and action what we can do, but who operate? Do you think who does that? Will you get it! No problem, I told you that we called them operators or sales assistants in the shop. In our programming term, we called them reducers. An operator tackles all calculations needed and what to do on every client query and handles everything. Reducer does that same as a salesman. Reducer manages all sate that exists after user actions — based on action reducer update state related to action.</p><p>If you understood the above three points, you could believe that you know about redux, the next step to apply in projects. Who stops you! Just jump the following line and continue you do that.</p><p>So, what is the first step? Yes, you caught that and already did that! We need to install redux in our react projects, in partially install react-redux, now we make a folder to do our know three points store, action, reducer. We start from actions….</p><p><strong>Action</strong></p><p>We need to take some actions here like selling toys or importing toys. The action is just like an object, nothing else. Here is an example</p><p>{</p><p>type: “SELL_TOY”,</p><p>input: “SELL_FRUITS”</p><p>}</p><p>{</p><p>type: “IMPORT_FRUITS”,</p><p>input: “NEW_IMPORT_FRUITS”</p><p>}</p><p>We use unique type names to identify every action. We use here two option types and input we can use more as we need. We make the two actions we use when we need these types of activities.</p><p>Here is one problem that arises every time to type action same when needed so, we make an action helper function. We simply called the action helper function when needing this type of action. Just our code more simple!</p><p>function importToy (importData){</p><p>return {</p><p>type: “SELL_TOY”,</p><p>input: importData,</p><p>}</p><p>}</p><p>We use this function when needed and can add data dynamically every time. Then what?</p><p><strong>Reducer</strong></p><p>We take that action, and now we need an operator who handles all actions. So we know our salesman is a reducer, now create a reducer who stops me!</p><p>function shopManagement (state={}, action){</p><p>switch(action.type){</p><p>case “SELL_TOY”:</p><p>const newState = state — action.toys;</p><p>return newState;</p><p>case “IMPORT_TOY”:</p><p>const newState = state + action.toys;</p><p>return newState;</p><p>default :</p><p>return state;</p><p>}</p><p>}</p><p>Our reducer does that all actions are based on the order. Hurray! We make that.</p><p><strong>Store</strong></p><p>We created actions and reducer but have not done our store yet. Can its time to create our store? ………..</p><p>Well, we can do that. What does life do?</p><p>import {createStore} from redux;</p><p>import shopManagement from ‘./shopManagement’;</p><p>const store = createStore(shopManagement);</p><p>export default store;</p><p>We have to hooks to create a store. The name is createStore(). Here we can make a single store. We can use another react-redux hook called combineReducer().</p><p>We make everything now time to use it our applications. So we need a provider who provides all data components without dilling data.</p><p>So we can set a provider on index.js file to provide our store data!</p><p>import store from ‘.store’;</p><p>&lt;Provider store={store}&gt;</p><p>&lt;App /&gt;</p><p>&lt;/Provider&gt;</p><p>We import providers from react-redux. Wow! We do every step. Now only interact with our components.</p><p>import { importToys } from ‘./actions/shopManagement’</p><p>const dispatch = useDispatch()</p><p>dispatch( importToys( listOfToys ) );</p><p>You can remember that importToys? It&#39;s our action helper function that returns an action to import toys.</p><p>Our reducer does work again this action and update state.</p><p>There is two way to retribute store data. I show here one way.</p><p>useSelector hooks, we can use that to use store data as props.</p><p>const <strong>allData </strong>= useSelector( function (state) {</p><p>return state</p><p>})</p><p>If there combined reducer/multiple state</p><p>const <strong>shopManagement </strong>= useSelector( function(state) {</p><p>return state.<strong>shopManagement</strong></p><p>})</p><p>Hooks way is a simple way, but some issues can’t handle hooks way. For example, we get an error until all data loads. So we can show that anythings until complete load all Data. The conditional way is called connect() hooks.</p><p>I am telling you more than this article so you can <a href="https://react-redux.js.org/api/connect">visit here</a> to know how to solve it conditional way.</p><p>Thanks</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=886eecf4406" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>