<?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 ravikiran niturkar on Medium]]></title>
        <description><![CDATA[Stories by ravikiran niturkar on Medium]]></description>
        <link>https://medium.com/@nravikiran5?source=rss-a5ddb385c7a3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*nLFnW9Qi6_Zf9k3g</url>
            <title>Stories by ravikiran niturkar on Medium</title>
            <link>https://medium.com/@nravikiran5?source=rss-a5ddb385c7a3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 03:43:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nravikiran5/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[BLOGS Crud with out DB day-2]]></title>
            <link>https://medium.com/@nravikiran5/blogs-crud-with-out-db-day-2-7644352e481b?source=rss-a5ddb385c7a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7644352e481b</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[mean-stack-development]]></category>
            <category><![CDATA[mean-stack]]></category>
            <category><![CDATA[expressjs]]></category>
            <dc:creator><![CDATA[ravikiran niturkar]]></dc:creator>
            <pubDate>Mon, 29 Jun 2026 19:56:17 GMT</pubDate>
            <atom:updated>2026-06-29T19:56:17.264Z</atom:updated>
            <content:encoded><![CDATA[<p>Day 2</p><p><strong>Refactored (Simple English):</strong></p><p>Now that we have created the <strong>GET API</strong>, it’s time to test it in the frontend. If we try to consume this API from the frontend, we will get a <strong>CORS error</strong> because the frontend and backend are running on different origins. To fix this, install the following dependencies:</p><ul><li><strong>CORS</strong> — Allows the frontend to access the backend API by enabling Cross-Origin Resource Sharing.</li><li><strong>Nodemon</strong> — Automatically restarts the Node.js server whenever you make changes, so you don’t have to restart it manually every time.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cLn8wgTSyLbIdpaFtoh1QA.png" /><figcaption><strong>Install CORS and Nodemon as project dependencies.</strong></figcaption></figure><p>Now it’s time to consume the API in the frontend. Because CORS has been configured in the backend, the frontend can access the API without getting a CORS error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ILDDBPvke2cgpZego0HZwg.png" /></figure><p>now we will add the error handling these API</p><pre> res.status(500).json({<br>      success: false,<br>      message: &#39;Error fetching blogs&#39;,<br>      error: error.message<br>    });</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*qDH2zBoJ0KDII-dqqir6fg.png" /></figure><p>Now it’s time to implement the Single Blog Fetch API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*leNXKlc_th5ME7cY69GPLg.png" /></figure><p>Let’s create the API to add a new blog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*z_xyXzQ6n82dXJXXSe_NJw.png" /></figure><p>At <strong>line 68</strong>, we extract the <strong>title</strong>, <strong>content</strong>, and <strong>author</strong> from req.body using <strong>object destructuring</strong>.</p><p>After that, at <strong>line 70</strong>, we add backend validation to ensure that <strong>title</strong> and <strong>content</strong> are provided. These are mandatory fields required to save a new blog in the database.</p><p>Now its time to consume this API in frontend</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qQZ5K5i0mmescGief07rDQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7644352e481b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NgRx — State Management — 4]]></title>
            <link>https://medium.com/@nravikiran5/ngrx-state-management-4-caa261763ec9?source=rss-a5ddb385c7a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/caa261763ec9</guid>
            <dc:creator><![CDATA[ravikiran niturkar]]></dc:creator>
            <pubDate>Sun, 18 Jan 2026 14:42:33 GMT</pubDate>
            <atom:updated>2026-01-18T14:42:33.060Z</atom:updated>
            <content:encoded><![CDATA[<h3>NgRx — State Management — 4</h3><h3>Dealing with Actions in Redux</h3><p>Actions are the events that tell Redux something has happened and the state needs to change. In an Angular app using NgRx, actions are dispatched from components to trigger these updates.</p><p>You’ll learn how to define action objects with a <strong>type</strong> and an optional <strong>payload</strong>, and how action creators make creating actions easier and cleaner. This gives you a strong foundation for handling state changes through actions and reducers.</p><h3>Introduction to actions</h3><p>When a user interacts with the app, the component triggers an <strong>action</strong>. An action is just a plain JavaScript object that describes what kind of change should happen to the state.</p><p>Redux sends this action to the <strong>reducer</strong>, and the reducer updates the state based on the information in that action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*EHsp3ZJfNb_vb7mZMZtx2A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*_V-BRNfirOgKxXF8BXOEPQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*J99JJ-tgchkmIJSE1gwVqA.png" /><figcaption>1 Action is dispatched by the component 2 Action is forwarded to the reducer 3 Reducer takes the current state from the store</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*c3RNbsYLZ-IgC2MIUspMRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*RwQeEkxMMtCtC8LXfykG1A.png" /><figcaption>4 Reducer mutates the state 5 Component subscribes to the store</figcaption></figure><h3>Action structure</h3><p>An <strong>action</strong> is just a simple JavaScript object.<br> It has two main parts:</p><ul><li><strong>type</strong> (required):<br> This tells <em>what happened</em>. It is always a <strong>string</strong>.</li><li><strong>payload</strong> (optional):<br> This contains the data needed for the action (for example, product details).</li></ul><h3>How we write the type</h3><p>Usually, the type is written in <strong>two parts</strong>:</p><ol><li><strong>Feature name</strong><br> This tells <em>which part of the app</em> the action belongs to<br> (for example: Product, User, Cart).</li><li><strong>Event name</strong><br> This tells <em>what the user did </em>(for example: Add, Remove, Update).</li></ol><h3>Example</h3><p>Suppose a user clicks the <strong>“Add to cart”</strong> button.<br> This action belongs to the <strong>Product</strong> module.</p><p>So we can create an action like this:</p><ul><li>Feature name: Product</li><li>Event name: Add to Cart</li></ul><p>This action tells Redux: <em>User added a product to the cart.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FlSjbgWWaZcWkIFHtZCUTQ.png" /><figcaption>Example of an action object</figcaption></figure><p>In the example above, [Product] is the feature or module name, and Add to cart is the event that the user triggers.</p><p>The payload property contains the new data. The structure of the payload can be of any data type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IebXN-CFJaeCA-anUuCAdQ.png" /></figure><h3>Introduction to action creators</h3><p>A typical Redux application contains lots of actions. To reduce duplication, we use the action creator function to generate actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8pE2LteMJ0mhFFoWu8TeeA.png" /><figcaption>Example of an action creator function</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=caa261763ec9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NgRx — State Management — 3]]></title>
            <link>https://medium.com/@nravikiran5/ngrx-state-management-3-6d2a7ef97554?source=rss-a5ddb385c7a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d2a7ef97554</guid>
            <dc:creator><![CDATA[ravikiran niturkar]]></dc:creator>
            <pubDate>Sun, 18 Jan 2026 14:24:42 GMT</pubDate>
            <atom:updated>2026-01-18T14:24:42.289Z</atom:updated>
            <content:encoded><![CDATA[<h3>NgRx — State Management — 3</h3><h3>Redux Store</h3><p>The Redux store is a central place where the entire application’s state is kept. This data cannot be changed directly. The store itself is just a plain JavaScript object that holds all the state information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C-bgtJoFIz5sOuIGAsqobA.png" /></figure><p>In Angular apps, we often use services to share data between multiple components. Components subscribe to these services and get notified whenever the data changes, so they can update themselves.</p><p>The downside of this approach is that we end up creating many services. In large applications, managing and maintaining all of these services can become difficult.</p><figure><img alt="Service-based approach to data sharing in an Angular application" src="https://cdn-images-1.medium.com/max/892/1*8PJfcbKHd7jaF2ey8030zA.png" /></figure><p>Redux solves this problem in a cleaner way. Instead of spreading state across many services, Redux keeps all application state in one single store. All components simply subscribe to that store, rather than subscribing to multiple services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*oRncTDqzQKaPgtYkAkP4Tw.png" /><figcaption>Redux-based approach to data sharing in an Angular application</figcaption></figure><h3>Store Organization</h3><p>We shouldn’t put <em>every</em> piece of application data into the Redux store. To get the best results from Redux, the store needs to be planned carefully.</p><p>In general, application state can be divided into three types. Here’s how to handle each one:</p><ul><li><strong>Global state</strong><br> This is data that can be used anywhere in the app and is needed by many components. This kind of state should be kept in the Redux store.</li><li><strong>Multicomponent state</strong><br>This data is shared by more than one component. It often makes sense to keep it in the store. However, if the components are in a parent–child relationship, you can share the data using prop-lifting or prop-drilling instead. In that case, the store is not required.</li><li><strong>Local state</strong><br> This is data that belongs to a single component and isn’t shared with others. Local state should stay inside the component and does not need to be stored in Redux.</li></ul><h3>Fewer HTTP requests</h3><p>When a component makes an HTTP request to get data from the backend, we can store that data in the Redux store. This helps reduce repeated API calls.</p><p>For example, on the home page of an e-commerce app, we usually show a list of products. To display them, we make an HTTP request to the server. If the user leaves the page and comes back, the same request is made again.</p><p>With Redux, we can fetch the data once, save it in the store, and reuse it later. Because of this, the page loads faster and we avoid unnecessary network calls.</p><figure><img alt="Client-server communication in a nonRedux-based application" src="https://cdn-images-1.medium.com/max/885/1*U36_EBP9d5o6VFua4dR_Pw.png" /><figcaption>Client-server communication in a nonRedux-based application</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*jeEKkWbUkmYTkMW307asWw.png" /><figcaption>Client-server communication in a Redux-based application</figcaption></figure><p>If the data is frequently being changed, then we should avoid this approach.</p><p><strong>Non-serializable data</strong> is data that can’t be stored directly in a normal database. To store it, we first need to convert it into another format — this process is called serialization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_qaRXEOwcdVTtFKCoPjRew.png" /></figure><p>This kind of data usually includes:</p><ul><li>Data that is too large to store in a database</li><li>Data that needs some processing before it can be saved</li><li>Data that changes very often, such as live video streams or social media feeds</li><li>Things like JavaScript Promises, Symbols, Maps, Sets, functions, and class objects</li></ul><p>If we store <strong>non-serializable data</strong> in the Redux store, we can lose information or run into bugs.</p><p>For example, suppose we store a <strong>Set</strong> in the Redux store. A Set comes with built-in methods like has() and add(). When Redux tries to handle or serialize this data, those methods may not work as expected — which can lead to problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffoBH5Mqzo1NNqrWzR7keQ.png" /><figcaption>Performing built-in operations on Set</figcaption></figure><p>If we serialize data using JSON.stringify(), it will be converted to the string data type. As a result, we won’t be able to use the built-in functions of Set anymore.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M7W_d9qaVYc3ZgdmVeCTfQ.png" /><figcaption>Performing built-in operations on serialized data</figcaption></figure><p>The last example shows that non-serializable data should not be stored in the Redux store, because once we retrieve it, we may not be able to perform the required operations on it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d2a7ef97554" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NgRx — State Management — 3]]></title>
            <link>https://medium.com/@nravikiran5/ngrx-state-management-3-f860a791ca17?source=rss-a5ddb385c7a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f860a791ca17</guid>
            <dc:creator><![CDATA[ravikiran niturkar]]></dc:creator>
            <pubDate>Thu, 15 Jan 2026 18:49:45 GMT</pubDate>
            <atom:updated>2026-01-15T19:08:40.340Z</atom:updated>
            <content:encoded><![CDATA[<h3>NgRx — State Management — 3</h3><h3>Redux State</h3><h3>Fundamentals of state</h3><p>We’ll build a simple counter app to understand the concept of state.</p><p>Let’s create an HTML file named index.html.</p><ul><li>Insert an h1 tag to display the counter value.</li><li>Insert a button to let the user increment the value by one.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*khBxjEA44BP6KFr2q7AEgA.png" /></figure><p>Now, let’s create a JavaScript file named index.js.</p><ul><li>Declare a variable counter and initialize it with 0.</li><li>Declare a function add() to increment the counter value by one and display the updated value in the h1 tag.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d8B1Wfx3MCfb81soUSGe1w.png" /></figure><h3>Example</h3><p>At the beginning, the counter value is <strong>0</strong>. So we can say the initial <strong>state</strong> of the counter is 0.</p><p>When a user interacts with the app, the state changes. In this example, the action is clicking a button.</p><p>Now imagine the user clicks the button three times. The counter value becomes <strong>3</strong>. At this point, we can say the counter’s state has changed from 0 to 3.</p><p>From this example, we can define <strong>state</strong> like this:<br>State describes how all the data in an application is stored and how it changes when users interact with the app.</p><h3>Types of state</h3><p>In most applications, we usually deal with <strong>three types of state</strong></p><ul><li><strong>Global state</strong></li><li><strong>Multi-component state</strong></li><li><strong>Local state</strong></li></ul><p>Let’s look at each one of these in the next sections.</p><h3>Global state</h3><p>Global state holds data that can be used anywhere in the application.<br> All components can access this data whenever they need it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9zobwzgC3VA3LADck6Lj-g.png" /></figure><p>Let’s look at an example:</p><p>In the example above, there are three components: profileComponent, checkoutComponent, and shoppingCartComponent. All of them need the user’s name.</p><p>To make this easy, we store the user’s name in a global state called user. Because of this, every component can access the name directly without passing it around.</p><p><strong>Multicomponent state</strong></p><p>means a piece of state that is shared by multiple components in an application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gCw9LkpVekQnw-h_wS8BMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cMahCvKPeEiOhz8kphxeTw.png" /></figure><p>In the example above, both profileComponent and checkoutComponent need the user’s email, but shoppingCartComponent does not.</p><p>Because this email is shared by more than one component, we can call user.email a <strong>multicomponent state</strong>.</p><h3>Local states</h3><p><strong>Local state</strong> is the data that belongs to a single component. It is used only inside that component and is not shared with any other components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*To2t03YQN3sl0hcZtXLtDw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e42wJ4ZluGK0Kpl9x-J0Jg.png" /></figure><p>The products data is used by the shoppingCartComponent in the example above. It isn’t used by any other components. This is why we refer to products as a local state.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f860a791ca17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NgRx — State Management — 2]]></title>
            <link>https://medium.com/@nravikiran5/ngrx-state-management-2-ee0c7e473b2f?source=rss-a5ddb385c7a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee0c7e473b2f</guid>
            <dc:creator><![CDATA[ravikiran niturkar]]></dc:creator>
            <pubDate>Mon, 12 Jan 2026 20:24:52 GMT</pubDate>
            <atom:updated>2026-01-12T20:37:26.518Z</atom:updated>
            <content:encoded><![CDATA[<h3>NgRx — State Management — 2</h3><h3>Redux Principles</h3><p>Learn the basic ideas behind Redux and how it helps manage state in an Angular app. You’ll see how to create one central store, send actions to update the state, and use reducers to apply those changes.</p><p>This lesson also includes practical exercises where you’ll build a store, define actions, and write reducers — all while following Redux’s one-way data flow.</p><h3>The three principles of Redux</h3><p>Redux is built around three main ideas:</p><ol><li><strong>There is only one source of truth</strong> — your entire app’s state lives in a single place called the <em>store</em>.</li><li><strong>You can’t change the store directly</strong> — the only way to update it is by dispatching actions.</li><li><strong>All changes are handled by pure functions called reducers</strong> — they take the current state and an action, then return a new state.</li></ol><p>We’ll look at each of these principles in more detail next.</p><h3>The first principle</h3><p>In Redux, all of the app’s state is stored in one single JavaScript object called the <strong>store</strong>.<br> Your components (or views) simply subscribe to the store and read whatever data they need from it.</p><h3>Create a store</h3><p>Let’s create our first store from scratch:</p><ol><li>Declare a variable named store and initialize it with an empty object{}.</li><li>Add the properties name: &#39;John Doe&#39; and email: john@doe.com to the store.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jJstYH2vzJuQGyZOTXcrLA.png" /></figure><h3>The second principle</h3><p>When something in the app needs to change — for example, after a user interaction — the component sends (dispatches) an <strong>action</strong>.</p><p>An action is just a plain JavaScript object. It contains:</p><ul><li><strong>type</strong> — what kind of change should happen (required)</li><li><strong>payload</strong> — any extra data needed to make the change (optional)</li></ul><p>This action is then passed to a <strong>reducer</strong>, which decides how the state should be updated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9g_xh_Ii80Vp1H_q75GG2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r8iYFC9MvT1kVJgpItMVOw.png" /><figcaption>Action is dispatched by the component and Action is forwarded to the reducer</figcaption></figure><p>Create an action</p><p>Let’s write a simple action:</p><ol><li>Create a variable called action and assign it an empty object {}.</li><li>Add two properties to it:</li></ol><ul><li>type with the value &#39;CHANGE_EMAIL&#39;</li><li>payload with the value johndoe@email.com</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eodi7qvmxxd7rrQmlCwHcg.png" /></figure><h3>The third principle</h3><p>In Redux, a component cannot change the store directly. Instead, all state updates happen through <strong>reducers</strong>.</p><p>A reducer is a function that takes two inputs — the current state and an action. It uses the details in the action to decide how the state should change and returns a new state.</p><p>Since components are already subscribed to the store, they automatically receive the updated data when the state changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*cZTVpZiRLU-enyR1QRKqCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*qMxUMOmi9pZvJfdIzJrwKA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*9tJc-GIUADzehQ5Xg8wIkA.png" /><figcaption>1 Reducer takes the current state from the store. 2 Reducer mutates the state. 3 Component subscribes to the store</figcaption></figure><h3>Create a reducer</h3><p>Let’s code a reducer function. The initial code is provided.</p><ol><li>Create a copy of the store and hold the new object in a variable named newState.</li><li>Update the email property of newState using email: action.payload.</li><li>Finally, return the newState.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*14Eytm67WLSYnRvV-Ohykg.png" /></figure><ul><li>In <strong>line 14</strong>, the reducer function takes the store and action as its arguments.</li><li>Since a reducer function can handle multiple actions, we use a switch function to check the action.type in <strong>line 15</strong>. Inside the switch function, we define a case for CHANGE_EMAIL.</li><li>In <strong>line 17</strong>, we declare a variable newState to hold our updated state.</li><li>In <strong>line 18</strong>, we copy all the properties of store into the newState by using the JavaScript spread operator (...). The JavaScript spread operator implicitly copies only the top-level properties of the store. This is called a <strong>shallow copy</strong>.</li><li>Finally, we update the email property with the updated email from action.payload at <strong>line 19</strong> and return the newState at <strong>line 22</strong>.</li></ul><p>The following Images illustrate the unidirectional dataflow of the Redux architecture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*rdOpqYWVelMLg6J--h6Cmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*aV9w9nxlZ8BiKA-_oOFsRw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*HAYarrooQC_kA9V4W3KFkA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*D3qgDrLf0YDDbCIlnYoVcA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*FlycTrcZ0I9dJEIl7i7Rag.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee0c7e473b2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NgRx — State Management — 1]]></title>
            <link>https://medium.com/@nravikiran5/ngrx-state-management-1-affacbf3d6e4?source=rss-a5ddb385c7a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/affacbf3d6e4</guid>
            <dc:creator><![CDATA[ravikiran niturkar]]></dc:creator>
            <pubDate>Mon, 05 Jan 2026 19:50:48 GMT</pubDate>
            <atom:updated>2026-01-05T19:50:48.904Z</atom:updated>
            <content:encoded><![CDATA[<h3>NgRx — State Management — 1</h3><h3>Introduction to Redux</h3><p>Learn the core ideas behind Redux and the Flux-style architecture it follows. You’ll see how Redux keeps all application state in one central store and uses actions and reducers to manage changes. You’ll also understand why one-way (unidirectional) data flow is helpful — and why knowing Redux makes it easier to learn NgRx later.</p><h3>What is Redux?</h3><p>Redux is a library that helps manage application state in a clear, predictable way. Instead of state being spread everywhere, Redux keeps it organized and easier to control.</p><p>It was first created for React, but it can now be used with many different frameworks. Developers like Redux because it simplifies complex apps, especially when there are many pieces of data that need to stay in sync.</p><h3>Why learn Redux before NgRx?</h3><p>NgRx is built on top of Redux and adds extra features like selectors, Observables, and Effects. These tools help manage side effects — for example, calling an API or updating the UI when something happens.</p><p>Because NgRx is more advanced, it’s easier to understand if you already know Redux first. Redux gives you the basics, and NgRx builds on top of those ideas.</p><h3>What is Flux?</h3><p>Redux is based on an architecture called <strong>Flux</strong>. Flux is a pattern used to build front-end applications. It was first introduced by Facebook during the F8 conference in 2014.</p><h3>Why do we need Flux?</h3><p>Older patterns like MVC, MVVM, and two-way data binding can create <em>cascading updates</em>. This means one UI change triggers another, then another — which can slow the app down.</p><p>Here’s a simple way to look at it:</p><p>In many apps, several components depend on the same data. If one component updates that data, the others also need to update so everything stays consistent. In big apps, developers often end up using <strong>prop-lifting</strong> and <strong>prop-drilling</strong>, which quickly becomes messy.</p><ul><li><strong>Prop-lifting:</strong> passing updated data <em>upward</em> through parent components until it reaches the right place (or the root).</li><li><strong>Prop-drilling:</strong> passing data <em>downward</em> through child components until it reaches the component that needs it.</li></ul><p>Flux — and later Redux — were created to solve these problems in a cleaner way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*JtkAyALuFKUFf_sLJxfLtw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*1ND3ZM73DtUFWMpLKcQEgA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*qdz58QjtOLkAQALEFgfw7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*50PUDoJRNzJSkVd7TCYpwQ.png" /><figcaption>The green components use the same data</figcaption></figure><p>It’s important to realize that without a good state-management approach, updating every component in an app becomes slow and messy. To fix this, Facebook introduced a pattern with <strong>one-way data flow</strong> so that UI changes don’t keep triggering more changes in a chain.</p><h3>Flux architecture</h3><p>In Flux, data always moves in <strong>one direction</strong>. That’s one of the key ideas behind it.</p><h3>Action</h3><p>An <strong>action</strong> is just a plain JavaScript object. It contains:</p><ul><li>the data that needs to be updated, and</li><li>the type of change we want to perform.</li></ul><p>The action then sends this information to the <strong>dispatcher</strong>.</p><h3>Dispatcher</h3><p>In a Flux app, <strong>all data passes through a single dispatcher</strong> — there is only one.<br> Its job is to call the correct functions registered by the stores and manage dependencies between them.</p><h3>Store</h3><p>The <strong>store</strong> holds the entire application state.<br> In Flux, there can be multiple stores.</p><p>Each store:</p><ul><li>contains the logic for updating the state,</li><li>changes the state when needed, and</li><li>then emits a <strong>change event</strong>.</li></ul><h3>View</h3><p>The <strong>views/components</strong> listen for these change events.<br> When a store updates, the views refresh themselves with the new data.<br> Views can also trigger actions when the user interacts with the UI — which starts the cycle again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8WpY6m5_pqxqddWWihEjsw.png" /></figure><p><strong>How Redux was created</strong></p><p>After Facebook introduced Flux at the F8 conference in 2014, developers all over the world started building their own versions and sharing them as open source. As a result, many npm libraries were created that followed the Flux pattern.</p><p>Out of all those libraries, <strong>Redux</strong> became the most popular. It was introduced by Dan Abramov at the ReactEurope conference in 2015.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t6uH-uND2-aX0OK62RMjEw.png" /><figcaption>Unidirectional dataflow in Flux</figcaption></figure><p><strong>Flux vs Redux</strong></p><p>Even though Redux is inspired by Flux, there are some important differences.</p><ul><li><strong>Single store vs multiple stores</strong><br> Redux keeps all app data in <strong>one central store</strong>, which makes it easier to manage and keeps everything consistent.<br> Flux, on the other hand, allows <strong>multiple stores</strong>.</li><li><strong>Dispatcher</strong><br> In Flux, a central dispatcher sends actions to all stores.<br> In Redux, there’s <strong>no separate dispatcher</strong> — the store itself can dispatch actions, which keeps things simpler and more flexible.</li><li><strong>State updates</strong><br> Flux stores can directly change (mutate) the state.<br> In Redux, the store <strong>never mutates state directly</strong>. Instead, changes happen through <strong>reducers</strong>, which return a new version of the state.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=affacbf3d6e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[4 Rx Pattern and Observable]]></title>
            <link>https://medium.com/@nravikiran5/4-rx-pattern-and-observable-b126be990e21?source=rss-a5ddb385c7a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/b126be990e21</guid>
            <dc:creator><![CDATA[ravikiran niturkar]]></dc:creator>
            <pubDate>Fri, 02 Jan 2026 19:03:00 GMT</pubDate>
            <atom:updated>2026-01-02T19:03:00.386Z</atom:updated>
            <content:encoded><![CDATA[<p>Learn how the Rx pattern works by seeing how Observables send (or “emit”) values over time and push those values to anyone who subscribes. You’ll also see the difference between <em>pushing</em> data and <em>pulling</em> data in reactive programming, and how RxJS helps you manage async data streams in a clean way.</p><p>The Observer pattern and the Iterator pattern are both useful on their own — but when you combine them, they become even more powerful. This mix is what we call the <strong>Rx pattern</strong>, named after the Reactive Extensions libraries. We’ll be using this approach from here on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zL1bMckqb4W7f8WVerM43w.png" /></figure><p>The Observable sequence — or just “Observable” — is at the heart of the Rx pattern. It sends out values one after another, similar to an iterator. But instead of consumers asking for the next value, the Observable <em>pushes</em> the values to them whenever they’re ready.</p><p>In that sense, an Observable works a lot like the Producer from the Observer pattern: it creates values and sends them to whoever is listening.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JanXtC2s-jQZEccyRM3qgg.png" /></figure><p>Simply put, an Observable is just a sequence where the items show up over time. The things that receive those items are called Observers, and they work like listeners in the Observer pattern. Once an Observer subscribes to an Observable, it automatically receives each value as it comes — no need to ask for them.</p><p>At first, this may sound almost the same as the normal Observer pattern. But there are two big differences:</p><ul><li>An Observable won’t start sending values until at least one Observer has subscribed.<br> • And, like an iterator, an Observable can let you know when it has finished sending all of its values.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fbBaC64SZc0KLWZuVq4rcQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b126be990e21" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Iterator Pattern]]></title>
            <link>https://medium.com/@nravikiran5/3-iterator-pattern-facc3944a31f?source=rss-a5ddb385c7a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/facc3944a31f</guid>
            <dc:creator><![CDATA[ravikiran niturkar]]></dc:creator>
            <pubDate>Fri, 02 Jan 2026 18:48:57 GMT</pubDate>
            <atom:updated>2026-01-02T18:48:57.409Z</atom:updated>
            <content:encoded><![CDATA[<p>Take a look at the Iterator pattern in RxJS and see how it gives you an easy way to move through data, even when it arrives asynchronously. You’ll learn how methods like next() and hasNext() hide the details of how the data is being retrieved, which makes reactive programming easier to work with and easier to scale.</p><p>An Iterator is an object that lets you move through a collection of items in an easy way, without needing to know how everything is stored internally.</p><p>The Iterator interface is very simple. It usually has just two methods:<br> • next() — gives you the next value in the sequence<br> • hasNext() — tells you whether there are more values left</p><p>In the next example, we’ll create an Iterator that works on an array of numbers, but it will only return numbers that are multiples of a given divisor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XqdmM1vPPQlpwjNS0TF8Qg.png" /><figcaption>Iterator to operate on an array of numbers</figcaption></figure><p>We can use Iterator like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tBzm-aWZusaSkLqyocntqg.png" /><figcaption>Another implementation of the Iterator</figcaption></figure><p>Let’s compile and run the codes given above:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tfotxmosX1pLX40lpK_FiA.png" /><figcaption>Final implementation of the Iterator pattern</figcaption></figure><p>Iterators are useful because they hide the logic of how we move through data — no matter what kind of structure that data is in. As we saw in the example, they become really powerful when they’re generic (so they can work with different kinds of data) or when we can configure how they behave while the program is running.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=facc3944a31f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2 Observer Patterns]]></title>
            <link>https://medium.com/@nravikiran5/2-observer-pattern-4dfeac3928e6?source=rss-a5ddb385c7a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4dfeac3928e6</guid>
            <dc:creator><![CDATA[ravikiran niturkar]]></dc:creator>
            <pubDate>Thu, 01 Jan 2026 19:01:02 GMT</pubDate>
            <atom:updated>2026-08-04T06:16:38.697Z</atom:updated>
            <content:encoded><![CDATA[<p>Learn the Observer pattern by creating a small example with a Producer and some Listeners. You’ll see how this approach separates the code that sends events from the code that reacts to them, and how it makes async programming easier when using RxJS. This will also help you understand the main idea behind “reactive programming” and how Observables work.</p><p>If you’re a developer, it’s almost impossible to hear about Observables without thinking of the classic Observer pattern. In this pattern, there’s a Producer object that keeps a list of Listeners who have subscribed to it. Whenever something changes inside the Producer, it tells all the Listeners by calling their update() method.</p><p>In many explanations, this Producer is usually called a <em>Subject</em>. But since RxJS already has something called Subject, we’ll stick with the word <strong>Producer</strong> here to avoid confusion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MkvoScNGA4whTvG0WH5K0w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PRq15fl8byTJe0xVlWwxbw.png" /><figcaption>Implementation of the Producer object</figcaption></figure><p>The Producer object keeps a changing list of Listeners inside its listeners array. This list gets updated every time the Producer runs its notify method.</p><p>In the next example, we create two objects that “listen” to notifier, which is an instance of Producer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TitcyKrU1-sZ07vvDneQpg.png" /></figure><p>Run the following program:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zPZSH2NCY-lw5NB8EqmLBg.png" /></figure><p>Both listener1 and listener2 get notified whenever the notifier (the Producer) changes its internal state — and we don’t have to manually check anything.</p><p>The example is simple, but it clearly shows how the Observer pattern separates the code that <em>creates</em> events from the code that <em>responds</em> to them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4dfeac3928e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[1 Reactive Programming with RxJS]]></title>
            <link>https://medium.com/@nravikiran5/1-reactive-programming-with-rxjs-336f44c11115?source=rss-a5ddb385c7a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/336f44c11115</guid>
            <dc:creator><![CDATA[ravikiran niturkar]]></dc:creator>
            <pubDate>Thu, 01 Jan 2026 18:45:26 GMT</pubDate>
            <atom:updated>2026-01-01T18:45:26.400Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s build an easy example of a mouse stream using normal JavaScript event listeners. If we want to print the mouse’s x and y positions whenever someone clicks, we can write code like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NKwD4nWgWmOO87uPk8vNIw.png" /></figure><p>The problem is that working with events is harder than working with arrays. For example, suppose we want to change the previous code so it only records the first ten clicks that happen on the right side of the screen (I know that sounds random — just follow along). To do that, we’d have to write code like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VN_4Qk5MeMR0xSEJvJtYhg.png" /></figure><p>To make this work, we had to create a global variable called clicks that keeps track of how many times the mouse was clicked. We also had to check two conditions and use nested if statements. When everything is finished, we still need to remove the event listener so it doesn’t cause memory problems.</p><p>We did achieve our simple goal, but the code became more complicated than it should be. It’s harder to read and maintain, especially for someone seeing it for the first time. Even worse, because we’re manually keeping track of state, it’s easier for small bugs to appear later.</p><p>In this case, what we really want is just to <em>ask questions</em> about our list of clicks — almost like it’s a database. If this were a real database, we would use a declarative language like SQL to do that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dSMbJ4hCu6lj-RA0lTQjpQ.png" /></figure><p>What if we treated that stream of click events as a data source that can be queried and transformed? After all, it’s no different from a database—it is one that emits values in real-time. All we need is a data type that abstracts the concept for us.</p><p>Enter RxJS and its Observable data type:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TnlH0qPFeGj6E_MTRhVs3Q.png" /></figure><p>This code reads like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rofHFBtqma1kuJBflEaReQ.png" /></figure><p>Notice that this code is easy to understand, even if you’ve never seen it before. We don’t have to create extra variables to track things, so everything stays inside the code block itself. That means it’s less likely to break, and we don’t have to worry about cleaning things up later — so we avoid memory leaks from forgotten event listeners.</p><p>In this example, we created an Observable from a DOM event. An Observable gives us a stream of events that we can work with as a whole, instead of handling each event one at a time. Treating events like a sequence is very powerful. We can combine Observables, change them, or pass them around easily. In other words, we’ve turned events — which normally feel hard to control — into something like an array that’s easy to work with, but also much more flexible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=336f44c11115" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>