<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Raushan Kumar</title>
    <description>The latest articles on Forem by Raushan Kumar (@raushan606).</description>
    <link>https://forem.com/raushan606</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F425469%2Fc4cfdf6b-e746-488c-a82e-1a54940b26ac.jpeg</url>
      <title>Forem: Raushan Kumar</title>
      <link>https://forem.com/raushan606</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/raushan606"/>
    <language>en</language>
    <item>
      <title>Redux Principles</title>
      <dc:creator>Raushan Kumar</dc:creator>
      <pubDate>Tue, 08 Sep 2020 17:55:08 +0000</pubDate>
      <link>https://forem.com/raushan606/redux-principles-49jg</link>
      <guid>https://forem.com/raushan606/redux-principles-49jg</guid>
      <description>&lt;p&gt;Redux is a predictable state container. It stores the state of your application. It stores and manages the application state.&lt;/p&gt;

&lt;p&gt;In redux, all state transitions are explicit and is possible to keep track of them.&lt;/p&gt;

&lt;p&gt;Basically, there are three principles of redux:&lt;/p&gt;

&lt;h4&gt;
  
  
  1. First Principle:
&lt;/h4&gt;

&lt;p&gt;"The state of your whole application is stored in an object tree within a single store"&lt;/p&gt;

&lt;p&gt;Maintain our application state in a single object which would be managed by the Redux store.&lt;/p&gt;

&lt;p&gt;example:&lt;br&gt;
Let's assume we are tracking the number of ice-cream at the ice-cream parlor&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;numberOfIceCreams&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Second Principle:
&lt;/h4&gt;

&lt;p&gt;"The only way to change the state is to emit an action, an object describing what happened"&lt;/p&gt;

&lt;p&gt;To update the state of your app, you need to let redux know about that with action.&lt;/p&gt;

&lt;p&gt;example:&lt;br&gt;
Let the shopkeeper know about action - 'BUY_ICECREAM'&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nl"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BUY_ICECREAM&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  3. Third Principle:
&lt;/h4&gt;

&lt;p&gt;"To specify how the state tree is transformed by actions, you write pure reducers"&lt;/p&gt;

&lt;p&gt;Reducers - (prevState, action) =&amp;gt; newState&lt;/p&gt;

&lt;p&gt;example:&lt;br&gt;
Reducer is the shopkeeper.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;reducer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;switch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="na"&gt;BUY_ICECREAM&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
           &lt;span class="na"&gt;numberOfIceCreams&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;numberOfIceCreams&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
         &lt;span class="p"&gt;}&lt;/span&gt;
     &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Thank You, Happy Coding!!&lt;/p&gt;

</description>
      <category>react</category>
      <category>redux</category>
      <category>reactredux</category>
      <category>javascript</category>
    </item>
    <item>
      <title>React-Redux Learning Resources</title>
      <dc:creator>Raushan Kumar</dc:creator>
      <pubDate>Fri, 28 Aug 2020 15:46:45 +0000</pubDate>
      <link>https://forem.com/raushan606/react-redux-learning-resources-3a2l</link>
      <guid>https://forem.com/raushan606/react-redux-learning-resources-3a2l</guid>
      <description>&lt;p&gt;Resources link recommended by documentation of &lt;a href="https://redux.js.org/"&gt;Redux&lt;/a&gt;. These are very good resources to learn Redux from scratch.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://egghead.io/courses/getting-started-with-redux"&gt;Getting Started with Redux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://egghead.io/courses/building-react-applications-with-idiomatic-redux"&gt;Building React Applications with Idiomatic Redux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=xsSnOQynTHs"&gt;Live React: Hot Reloading and Time Travel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=93p3LxR9xfM"&gt;Redux Crash Course With React&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code-cartoons.com/a-cartoon-intro-to-redux-3afb775501a6"&gt;A Cartoon Guide to Redux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://css-tricks.com/learning-react-redux/"&gt;Leveling Up with React: Redux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/pshrmn/notes/blob/master/redux/redux.md"&gt;Redux Tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://devguides.io/redux/"&gt;DevGuides: Introduction to Redux&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Keep Learning!!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>redux</category>
    </item>
  </channel>
</rss>
