<?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>DEV Community: React JS Fan</title>
    <description>The latest articles on DEV Community by React JS Fan (@reactjsfan).</description>
    <link>https://dev.to/reactjsfan</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%2F614529%2Ffd8733f8-8660-4f69-97ad-7d6ad4295293.png</url>
      <title>DEV Community: React JS Fan</title>
      <link>https://dev.to/reactjsfan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/reactjsfan"/>
    <language>en</language>
    <item>
      <title>Redux-Cool Philosophy. How to solve the main problems which we usually face when we use Redux in complex projects.</title>
      <dc:creator>React JS Fan</dc:creator>
      <pubDate>Wed, 28 Apr 2021 18:15:38 +0000</pubDate>
      <link>https://dev.to/reactjsfan/redux-cool-philosophy-how-to-solve-the-main-problems-which-we-usually-face-when-we-use-redux-in-complex-projects-473j</link>
      <guid>https://dev.to/reactjsfan/redux-cool-philosophy-how-to-solve-the-main-problems-which-we-usually-face-when-we-use-redux-in-complex-projects-473j</guid>
      <description>&lt;p&gt;In this article, I am talking about the main problems which we usually face when we use Redux in complex projects. I will also talk about the new &lt;a href="https://redux-cool.js.org"&gt;Redux-Cool&lt;/a&gt; library, with the help of which we can solve those problems. I'm convinced that many developers using Redux need a similar article.&lt;/p&gt;

&lt;h2&gt;
  
  
  Motivation
&lt;/h2&gt;

&lt;p&gt;As we know &lt;strong&gt;Redux&lt;/strong&gt; is a predictable state container for JavaScript apps. Below you can find the architecture of Redux.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--07C-YuSY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://redux-cool.js.org/img/redux-diagram.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--07C-YuSY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://redux-cool.js.org/img/redux-diagram.png" alt="redux architecture diagram"&gt;&lt;/a&gt;&lt;br&gt;
As can be seen from the diagram above, we have a &lt;strong&gt;store&lt;/strong&gt; where our &lt;strong&gt;state data&lt;/strong&gt; is stored, and if we want to change something in the state, we must create an &lt;strong&gt;action object&lt;/strong&gt; which will contain all the information on how we need to change the state. Afterward, we need to dispatch the action object to the reducer. The reducer must receive the action object and based on that it will figure out what to change and how to make that change. This is how the state management works in Redux. Redux as a state management concept is really good because it is predictable - we are not changing the state directly.&lt;/p&gt;

&lt;p&gt;As we have already mentioned, Redux is very good as a state management concept, however, when we try to realize it in real and complex projects, we encounter numerous problems and headaches which is why many developers refuse to use Redux.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://redux-toolkit.js.org/"&gt;ReduxToolkit&lt;/a&gt; tried to solve these problems but with no result.&lt;/p&gt;

&lt;p&gt;I created the &lt;a href="https://redux-cool.js.org"&gt;Redux Cool&lt;/a&gt; to solve all of these problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problems
&lt;/h2&gt;

&lt;p&gt;Below are the main problems which we usually face when we use &lt;strong&gt;Redux&lt;/strong&gt; in complex projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem 1: Confusion and Boredom
&lt;/h3&gt;

&lt;p&gt;In many projects that have various features, there are many cases when it is required to change the state during some actions. We have to create a new &lt;em&gt;action type&lt;/em&gt; every single time, to add an &lt;em&gt;action handler&lt;/em&gt; for that in reducer, every time we have to &lt;em&gt;import&lt;/em&gt; the appropriate &lt;em&gt;action creator&lt;/em&gt;, create action and dispatch it. This is quite a boring process. Besides, we have many action creators and action handlers, which are just written one under another and not grouped in logical and visual form.&lt;/p&gt;

&lt;h5&gt;
  
  
  Solution:
&lt;/h5&gt;

&lt;p&gt;In &lt;strong&gt;Redux Cool&lt;/strong&gt;, the reducers are created with the help of a &lt;strong&gt;reducer tree&lt;/strong&gt; - the &lt;strong&gt;reducer tree&lt;/strong&gt; is a nested javascript object in which &lt;strong&gt;action-handler&lt;/strong&gt; functions are defined. Each &lt;strong&gt;action-handler&lt;/strong&gt; has its logical place in the &lt;strong&gt;reducer tree&lt;/strong&gt;. The hierarchical order of &lt;strong&gt;action-handlers&lt;/strong&gt; enables us to define reducer-logic in a grouped and visual form.&lt;/p&gt;

&lt;p&gt;Besides, in &lt;strong&gt;Redux Cool&lt;/strong&gt;, we don't have a separate &lt;strong&gt;action creator&lt;/strong&gt; function for each action, instead, we have one &lt;code&gt;actionsCreator&lt;/code&gt; action producer with which we can create any action object in dynamic and inline ways.&lt;/p&gt;

&lt;p&gt;See details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://redux-cool.js.org/docs/concepts/reducer-tree"&gt;Reducer Tree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://redux-cool.js.org/docs/concepts/reducers-creator"&gt;Reducers Creator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://redux-cool.js.org/docs/concepts/actions-creator"&gt;Actions Creator&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Problem 2: Define a Single Action In Multiple Reducers
&lt;/h3&gt;

&lt;p&gt;In complex projects, we are usually splitting our reducer functions into separate reducer functions, each managing independent parts of the state. Then, using the &lt;strong&gt;combineReducers&lt;/strong&gt; function of Redux, we are combining it creating one general reducer function. Very often, there is a need to have specific types of actions, which we would like to apply simultaneously to all reducers or to specific reducers. For example, when we have &lt;strong&gt;LOGOUT&lt;/strong&gt; action and during that action, we want to erase all the account-specific data that exists in our Redux state.&lt;/p&gt;

&lt;h5&gt;
  
  
  Solution:
&lt;/h5&gt;

&lt;p&gt;The actions have &lt;strong&gt;Global&lt;/strong&gt; and &lt;strong&gt;Local&lt;/strong&gt; contexts in &lt;strong&gt;Redux Cool&lt;/strong&gt;. The actions with Global context can be applied to various Reducers.&lt;/p&gt;

&lt;p&gt;See details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://redux-cool.js.org/docs/concepts/global-and-local-actions"&gt;Global And Local Actions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Problem 3: Actions With Callback capability
&lt;/h3&gt;

&lt;p&gt;Usually, when we are using Redux Middlewares for side effects(e.g. redux-saga), there is a need to have actions with &lt;strong&gt;Callback capability&lt;/strong&gt;.&lt;/p&gt;

&lt;h5&gt;
  
  
  Solution:
&lt;/h5&gt;

&lt;p&gt;In &lt;strong&gt;Redux Cool&lt;/strong&gt;, all the actions have Callback capability - by default, it is an identity function(x =&amp;gt; x) but we can pass any callback function during the creation of action.&lt;/p&gt;

&lt;p&gt;See details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://redux-cool.js.org/docs/concepts/actions-creator"&gt;Actions Creator&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redux</category>
      <category>react</category>
      <category>javascript</category>
      <category>reduxcool</category>
    </item>
    <item>
      <title>Redux Best Practice 2021 - Redux Cool</title>
      <dc:creator>React JS Fan</dc:creator>
      <pubDate>Wed, 14 Apr 2021 18:38:35 +0000</pubDate>
      <link>https://dev.to/reactjsfan/redux-best-practice-2021-redux-cool-5g86</link>
      <guid>https://dev.to/reactjsfan/redux-best-practice-2021-redux-cool-5g86</guid>
      <description>&lt;h1&gt;
  
  
  Build redux logic, without getting nervous ❤️
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/Ruben-Arushanyan/redux-cool"&gt;Redux Cool&lt;/a&gt;&lt;/strong&gt; is an awesome tiny package that allows you to easily and intuitively write redux logic. It is the collection of two separate libraries, one designed to create reducer functions and the other to create action objects: (&lt;a href="https://github.com/Ruben-Arushanyan/reducers-creator"&gt;Reducers Creator&lt;/a&gt; for creating reducers functions and &lt;a href="https://github.com/Ruben-Arushanyan/actions-creator"&gt;Actions Creator&lt;/a&gt; for creating actions object)&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;redux redux-cool
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;Create a file named &lt;code&gt;src/accountReducer.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;src/accountReducer.js&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;reducersCreator&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;redux-cool&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;initialState&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;reducerTree&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="na"&gt;PROFILE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

        &lt;span class="na"&gt;SET&lt;/span&gt;&lt;span class="p"&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&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;args&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;profile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;

        &lt;span class="na"&gt;UPDATE_EMAIL&lt;/span&gt;&lt;span class="p"&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&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;args&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;profile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;

    &lt;span class="na"&gt;CLEAR&lt;/span&gt;&lt;span class="p"&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="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;accountReducer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;reducersCreator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ACCOUNT&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;initialState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;reducerTree&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;accountReducer&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see in the example above, we create an &lt;strong&gt;&lt;code&gt;accountReducer&lt;/code&gt;&lt;/strong&gt; by calling the &lt;code&gt;reducersCreator&lt;/code&gt; function and passing it three arguments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;"ACCOUNT"&lt;/code&gt;&lt;/strong&gt; : It's the &lt;strong&gt;name&lt;/strong&gt; of the reducer, it can be any &lt;code&gt;String&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;initialState&lt;/code&gt;&lt;/strong&gt; : It's the &lt;strong&gt;initial state&lt;/strong&gt; of the reducer, it can be any &lt;code&gt;Object&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;reducerTree&lt;/code&gt;&lt;/strong&gt; : It's an &lt;code&gt;Object&lt;/code&gt; &lt;em&gt;(can have any deep and nested structure)&lt;/em&gt; that intuitively and in readible ways, defines &lt;code&gt;handler functions&lt;/code&gt; for reducer. &lt;code&gt;Handler functions&lt;/code&gt; as an argument take &lt;code&gt;state&lt;/code&gt; and &lt;code&gt;action&lt;/code&gt; and update the state. It automatically uses the &lt;a href="https://immerjs.github.io/immer/"&gt;immer library&lt;/a&gt; to do &lt;strong&gt;immutable updates&lt;/strong&gt; with normal mutative code, like &lt;code&gt;state.profile.data.email = email&lt;/code&gt;. There is no need to manually do immutable updates and return the result. If you are not familiar with the &lt;a href="https://immerjs.github.io/immer/"&gt;immer library&lt;/a&gt;, please look at it, it is very important.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As a result, we get the &lt;strong&gt;&lt;code&gt;accountReducer&lt;/code&gt;&lt;/strong&gt; function, which can handle the following type of actions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;types: &lt;code&gt;"PROFILE/SET"&lt;/code&gt; or &lt;code&gt;"ACCOUNT/PROFILE/SET"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;types: &lt;code&gt;"PROFILE/UPDATE_EMAIL"&lt;/code&gt; or &lt;code&gt;"ACCOUNT/PROFILE/UPDATE_EMAIL"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;types: &lt;code&gt;"CLEAR"&lt;/code&gt; or &lt;code&gt;"ACCOUNT/CLEAR"&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As you can see, each handler can work with &lt;strong&gt;two&lt;/strong&gt; types of actions, one consisting of the path described in &lt;em&gt;reducerTree&lt;/em&gt;, the second is the same as the first type plus the reducer name that should be added from the beginning like &lt;code&gt;"CLEAR"&lt;/code&gt; and &lt;code&gt;"ACCOUNT/CLEAR"&lt;/code&gt;. That is the most important and useful feature of this library.&lt;/p&gt;

&lt;h3&gt;
  
  
  In both cases (&lt;code&gt;"CLEAR"&lt;/code&gt; and &lt;code&gt;"ACCOUNT/CLEAR"&lt;/code&gt;), the &lt;strong&gt;CLEAR&lt;/strong&gt; handler is called in the &lt;strong&gt;accountReducer&lt;/strong&gt;, but when we have multiple reducers that have the &lt;strong&gt;CLEAR&lt;/strong&gt; handler and we need to clear the state of all reducers, we must use &lt;code&gt;"CLEAR"&lt;/code&gt; action type, but if we need to delete only the &lt;strong&gt;ACCOUNT&lt;/strong&gt; reducer state we must use the &lt;code&gt;"ACCOUNT/CLEAR"&lt;/code&gt; action type.
&lt;/h3&gt;



&lt;p&gt;Now that we have the &lt;strong&gt;accountReducer&lt;/strong&gt;, let's create the redux store&lt;/p&gt;

&lt;p&gt;Create a file named &lt;strong&gt;src/store.js&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;src/store.js&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;createStore&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;redux&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;actionsCreator&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;redux-cool&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;accountReducer&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./accountReducer.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;// Create Store&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;store&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;createStore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;accountReducer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// Dispatch Set Profile Action&lt;/span&gt;
&lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;actionsCreator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PROFILE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SET&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;test@test&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Test&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getState&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="c1"&gt;// {&lt;/span&gt;
&lt;span class="c1"&gt;//     profile: {&lt;/span&gt;
&lt;span class="c1"&gt;//         data: {email: 'test@test', name: 'Test'}&lt;/span&gt;
&lt;span class="c1"&gt;//     }&lt;/span&gt;
&lt;span class="c1"&gt;// }&lt;/span&gt;


&lt;span class="c1"&gt;// Dispatch Update Email Action&lt;/span&gt;
&lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;actionsCreator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PROFILE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;UPDATE_EMAIL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;test2@test2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getState&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="c1"&gt;// {&lt;/span&gt;
&lt;span class="c1"&gt;//     profile: {&lt;/span&gt;
&lt;span class="c1"&gt;//         data: {email: 'test2@test2', name: 'Test'}&lt;/span&gt;
&lt;span class="c1"&gt;//     }&lt;/span&gt;
&lt;span class="c1"&gt;// }&lt;/span&gt;



&lt;span class="c1"&gt;// Dispatch Clear Email Action&lt;/span&gt;
&lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;actionsCreator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;CLEAR&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getState&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="c1"&gt;// {&lt;/span&gt;
&lt;span class="c1"&gt;//     profile: {&lt;/span&gt;
&lt;span class="c1"&gt;//         data: null&lt;/span&gt;
&lt;span class="c1"&gt;//     }&lt;/span&gt;
&lt;span class="c1"&gt;// }&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/ruben-arushanyan/redux-cool"&gt;github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/RubenArushanyan"&gt;twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/redux-cool"&gt;npm&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

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