<?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 Sathiyapramod K R on Medium]]></title>
        <description><![CDATA[Stories by Sathiyapramod K R on Medium]]></description>
        <link>https://medium.com/@sathiyapramod22?source=rss-eea471375917------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*GWRYJRrBLhja25X0RuGwjQ.jpeg</url>
            <title>Stories by Sathiyapramod K R on Medium</title>
            <link>https://medium.com/@sathiyapramod22?source=rss-eea471375917------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 09:06:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sathiyapramod22/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[Implementing Redux Ducks Pattern in NextJS 14.1]]></title>
            <link>https://medium.com/@sathiyapramod22/implementing-redux-ducks-pattern-in-nextjs-13-4be50e3a5945?source=rss-eea471375917------2</link>
            <guid isPermaLink="false">https://medium.com/p/4be50e3a5945</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Sathiyapramod K R]]></dc:creator>
            <pubDate>Tue, 05 Dec 2023 15:51:09 GMT</pubDate>
            <atom:updated>2024-02-25T07:27:13.767Z</atom:updated>
            <content:encoded><![CDATA[<p>As the name suggests, this blog is on how to implement the redux state management in nextJS using the latest ducks pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YdgqrdzuYiPDE9Yd" /><figcaption>Photo by <a href="https://unsplash.com/@jupp?utm_source=medium&amp;utm_medium=referral">Jonathan Kemper</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Redux Currently has v14, however the project is built with javascript compared to typescript .</p><p>Steps involved in the Process.</p><ol><li>Installing nextjs latest version.</li><li>Utilising redux in nextJS by allowing the approach to use react-redux and @reduxjs/toolkit as dependencies.</li><li>Making the corresponding dispatch and selector functions for the States.</li></ol><h3>Step1 :Installing nextjs</h3><p>As per the latest nextjs document, by following the below installation in the command line, any one can install the required nextjs framework;</p><pre>npx create-next-app@latest</pre><p>One can customise to use either typescript or javascript based on the project’s requirement.</p><p>Now Include the react-redux and @reduxjs/toolkit as dependency to your project.</p><pre>npm install react-redux @reduxjs/toolkit</pre><h3>Step2 : Utilising Redux for State management</h3><p>As the nextjs comprises of Changes to be made in both layout and page in the Home, we need to make changes in both the components. Let us consider the simple Login form for making the Login component which comprises of the username and password using the below block of code.</p><p>P.S. password generally we don’t need to store as a state since Authentication being handled from Backend. So for Demo purpose, Considered the username with password for better reference.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8134768d1d5bb32943104032ef4a1c7/href">https://medium.com/media/b8134768d1d5bb32943104032ef4a1c7/href</a></iframe><p>Redux will be handled through redux ducks pattern here. More Details Available on the <a href="https://github.com/erikras/ducks-modular-redux">https://github.com/erikras/ducks-modular-redux</a>. As a First Step, in my project, Folder structure to be frozen as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/1*xjjbsop1LJoKnFUhu8NEzg.png" /><figcaption>Typical Folder Structure to be maintained under the root directory</figcaption></figure><p>I will now include the following code under each file to facilitate the redux central store for the state management</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5225b4a119af92106e0010a9d986adf6/href">https://medium.com/media/5225b4a119af92106e0010a9d986adf6/href</a></iframe><p>So inside the /redux/modules/index.js , I will be combining the reducers to facilitate in such a way , variables are available for fetching from the redux store.</p><p>To Configure the Store, I will be including the configureStore from @reduxjs/toolkit and proceeding.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f4c7bd7a39ebfc03392344f6ef423ae/href">https://medium.com/media/1f4c7bd7a39ebfc03392344f6ef423ae/href</a></iframe><p>Now, for the Provider component, I am not going to directly use against the layout.js rather I will make a round about and make another function called provider.js and wrapping up the children as shown below;</p><p>Coming to the layout.js which is a serverside component , I am making the necessary changes to wrap up the ReduxProvider component which is required for State changes(important).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa4704c850d133809aa740beda4c176b/href">https://medium.com/media/fa4704c850d133809aa740beda4c176b/href</a></iframe><p>So, Every username and password gets stored as redux variables and can be used for the further in Some Other component.</p><p>For Sample Demo, I am rendering the variables in a Profile.js component and rendering the variables for reference purpose.</p><p>P.S. rootReducer indicates the configured Store which we mentioned in the /redux/index.js</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fecddf27a79480867e029812232f6436/href">https://medium.com/media/fecddf27a79480867e029812232f6436/href</a></iframe><p>As I run the application, I will be able to see the username and password rendered on the Screen. This is a very basic Example on how to use the Redux Ducks pattern for the State management.</p><h3>Advantages of Redux Ducks pattern:</h3><ul><li>Conventional Type has folder/file approach which is clumpsy for major project which I need to bifurcate and maintain for long run. Redux Ducks pattern brings me the benefit to maintain all variables under one module and easy understanding.</li><li>actions and reducers are available on the same module and it becomes easy in terms of code readability.</li><li>Other major benefits, I am able to handle easy walk through through the code block with duck pattern compared with Old type redux folder structure.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4be50e3a5945" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Welcome Content]]></title>
            <link>https://medium.com/@sathiyapramod22/welcome-content-5df70543ddb1?source=rss-eea471375917------2</link>
            <guid isPermaLink="false">https://medium.com/p/5df70543ddb1</guid>
            <dc:creator><![CDATA[Sathiyapramod K R]]></dc:creator>
            <pubDate>Sun, 05 Mar 2023 10:55:50 GMT</pubDate>
            <atom:updated>2023-03-05T10:55:50.971Z</atom:updated>
            <content:encoded><![CDATA[<p>This Blog is meant as a Welcome Page for the Medium. I Would like to add more in the forecoming days</p><h3><strong>My Favourite Contents:</strong></h3><ul><li>Javascript</li><li>HTML</li><li>CSS</li><li>ReactJS</li><li>NodeJS — Express</li><li>MongoDB</li><li>Algorithms(Beginner level. Wanna learn more on the subject)</li></ul><p>Beautiful contents made on my github profile -<a href="https://github.com/Sathiyapramod">https://github.com/Sathiyapramod</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5df70543ddb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>