<?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: Masoud Pezeshkzade</title>
    <description>The latest articles on DEV Community by Masoud Pezeshkzade (@mpezeshkzade).</description>
    <link>https://dev.to/mpezeshkzade</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%2F267501%2Fcc4d5500-51f1-4f3b-b78d-b0a0a0f4a1dd.png</url>
      <title>DEV Community: Masoud Pezeshkzade</title>
      <link>https://dev.to/mpezeshkzade</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mpezeshkzade"/>
    <language>en</language>
    <item>
      <title>React native wallpaper app tutorial for beginners</title>
      <dc:creator>Masoud Pezeshkzade</dc:creator>
      <pubDate>Mon, 07 Sep 2020 05:43:31 +0000</pubDate>
      <link>https://dev.to/mpezeshkzade/react-native-wallpaper-app-tutorial-for-beginners-2fj6</link>
      <guid>https://dev.to/mpezeshkzade/react-native-wallpaper-app-tutorial-for-beginners-2fj6</guid>
      <description>&lt;p&gt;If you have ever tried to build your native mobile App with React Native, you may found it easy and intriguing as I did. Especially, if you are looking for a unique way to personalize your screen, I should admit you are on the right track on this page. This article, accompanied by other links mentioned in it completing the concept, is a complete guide through creating your specific wallpaper app, enabling you to modify its features as you like. &lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/4G18yd6vcho"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This wallpaper app has a drawer, search functionality, as well as different tabs of Community, Explore, and Favorite (first picture, inside the colored shape), looking roughly similar on both Android and iOS. You may find the &lt;a href="https://github.com/mdeveloper20/react-native-wallpaper"&gt;source code here on GitHub&lt;/a&gt;, useful. Also, if you are a beginner and feel more comfortable with video tutorials, this series of YouTube videos on my channel is prepared right for you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Iu25UoiS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8stsdcphv59uet7r6a9h.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Iu25UoiS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8stsdcphv59uet7r6a9h.jpg" alt="picture1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will use some tools such as Expo, NativeBase, BlueStacks, and some websites like unsplash.com and reactnative.dev . If you need to know more about how to install and apply them, here you can find it out.&lt;/p&gt;

&lt;p&gt;Ok! Let's start our project by introducing App.js including a homePage in its simple form:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import HomePage from './src/HomePage';

export default class App extends React.Component {
  constructor(props) {
    super(props);
  }

render() {

    return (
        &amp;lt;HomePage /&amp;gt;
        );
     } 
  }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The homePage component, on the other hand, has a header holding three tabs, as well as a search icon, and the Favorite tab as picture 1. So, here are our states:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;state = {
        favorites: [],
        isExploreLoading: false,
        searchBar: false,
        query: ''
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Through which our favorite pictures will be added to the "favorites" array, on click. “isExploreLoading” and “searchBar” render some parts of the application, and “query” is defined to provide search functionality by typing image name.&lt;/p&gt;

&lt;p&gt;Now, import your chosen Header from NativeBase and create your homePage as: (the … inside the code will be completed step by step)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;render() {

        return (
            &amp;lt;Container&amp;gt;
                &amp;lt;Header hasTabs searchBar={this.state.searchBar} &amp;gt;
                 …
                             &amp;lt;/Header&amp;gt;
                &amp;lt;Tabs &amp;gt;
                 …
                 &amp;lt;/Tabs&amp;gt;
            &amp;lt;/Container &amp;gt;
        );
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;1- SearchBar:&lt;/strong&gt;&lt;br&gt;
As the following picture shows, the searchBar holds a search icon, an input, and a “close” icon inside a transparent button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8FeVCT6R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tma9jd4ck4xqzh4w0nxo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8FeVCT6R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tma9jd4ck4xqzh4w0nxo.jpg" alt="picture2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So the “if condition” for clicking on search is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{this.state.searchBar ?
                        &amp;lt;&amp;gt;
                            &amp;lt;Item&amp;gt;
                                &amp;lt;Icon name="ios-search" /&amp;gt;
                                &amp;lt;Input placeholder="Search" onChangeText={this.onQueryChange} /&amp;gt;
                                &amp;lt;Button transparent onPress={() =&amp;gt; this.onSearchClick()}&amp;gt;
                                    &amp;lt;Icon name="close" /&amp;gt;
                                &amp;lt;/Button&amp;gt;
                            &amp;lt;/Item&amp;gt;
                            &amp;lt;Button transparent&amp;gt;
                                &amp;lt;Text&amp;gt;Search&amp;lt;/Text&amp;gt;
                            &amp;lt;/Button&amp;gt;

                        &amp;lt;/&amp;gt; :
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Where, the "onQueryChange" and "onSearchClick" functions outside of the render enable us to search for images by their name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;onQueryChange = (query) =&amp;gt; {
        this.setState({ query })
    }

onSearchClick = () =&amp;gt; {
        this.setState(state =&amp;gt; ({ searchBar: !state.searchBar, query: '' }))
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As picture 1 shows, there is a menu icon on the left side, a title next to the menu “My Wallpaper App”, and a search icon on the right side, if the search has not been clicked. So:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                        &amp;lt;&amp;gt;
                            &amp;lt;Left&amp;gt;
                                &amp;lt;Button transparent onPress={() =&amp;gt; this.props.openDrawer()}&amp;gt;
                                    &amp;lt;Icon name='menu' /&amp;gt;
                                &amp;lt;/Button&amp;gt;
                            &amp;lt;/Left&amp;gt;
                            &amp;lt;Body&amp;gt;
                                &amp;lt;Title&amp;gt;My Wallpaper App&amp;lt;/Title&amp;gt;

                            &amp;lt;/Body&amp;gt;
                            &amp;lt;Right&amp;gt;

                                &amp;lt;Button transparent onPress={() =&amp;gt; this.onSearchClick()}&amp;gt;

                                    &amp;lt;Icon name='search' /&amp;gt;
                                &amp;lt;/Button&amp;gt;
                            &amp;lt;/Right&amp;gt;
                        &amp;lt;/&amp;gt;
                    }

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



&lt;p&gt;&lt;strong&gt;2- Tabs:&lt;/strong&gt;&lt;br&gt;
According to picture 1, we have three tabs right below the header inside the container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Tabs &amp;gt;

     &amp;lt;Tab heading={&amp;lt;TabHeading&amp;gt;&amp;lt;Text&amp;gt;Community&amp;lt;/Text&amp;gt;&amp;lt;/TabHeading&amp;gt;}&amp;gt;
          &amp;lt;CommunityTab /&amp;gt;
     &amp;lt;/Tab&amp;gt;

     &amp;lt;Tab heading={&amp;lt;TabHeading&amp;gt;&amp;lt;Text&amp;gt;Explore&amp;lt;/Text&amp;gt;&amp;lt;/TabHeading&amp;gt;}&amp;gt;
          &amp;lt;ExploreTab /&amp;gt;
     &amp;lt;/Tab&amp;gt;

     &amp;lt;Tab heading={&amp;lt;TabHeading&amp;gt;&amp;lt;Text&amp;gt;Favorites&amp;lt;/Text&amp;gt;&amp;lt;/TabHeading&amp;gt;}&amp;gt;
          &amp;lt;FavoritesTab /&amp;gt;
     &amp;lt;/Tab&amp;gt;
&amp;lt;/Tabs&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To have a cleaner code, I prefer to create each tab as a specific component imported to the homepage component. For now, we define these components in their simple form, and in the upcoming parts, we will complete them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { Component } from "react";
import {Text} from "react-native";


class CommunityTab extends Component {
    state = {};

    render() {
        &amp;lt;Text&amp;gt;Community Tab &amp;lt;/Text&amp;gt;;
    }
}
export default CommunityTab;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Two other components would be generated by substituting their name in the above code.&lt;/p&gt;

&lt;p&gt;Congrats! You finished the first part of your specific App as simple as above. &lt;br&gt;
This App also includes menu, Community, Explore, and Favorite tabs need to be accomplished as the following pictures&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--woGmAdBC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ng8shk73l2pf6slyif0p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--woGmAdBC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ng8shk73l2pf6slyif0p.png" alt="picture 3"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uDy_Phl6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1ocf7so52rvawqhrfpqu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uDy_Phl6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1ocf7so52rvawqhrfpqu.jpg" alt="picture 4"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are interested in finalizing this App, join us on the full article of this &lt;a href="http://pezeshkzade.com/blog/how-to-build-a-wallpaper-app-in-react-native-for-beginners"&gt;react native beginner tutorial&lt;/a&gt; on my website here, or series of videos on &lt;a href="https://www.youtube.com/channel/UCEoaRTl5alo9tw3A-eDJV9Q/"&gt;my YouTube channel&lt;/a&gt;. I wrote a detailed-oriented article on the former and created a comprehensive series of videos on the latter one to help you improve your programming skills. I hope that you find them useful.&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>react</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Setup React Router v5 using React Hooks</title>
      <dc:creator>Masoud Pezeshkzade</dc:creator>
      <pubDate>Wed, 06 May 2020 15:17:32 +0000</pubDate>
      <link>https://dev.to/mpezeshkzade/how-to-setup-react-router-v5-using-react-hooks-367g</link>
      <guid>https://dev.to/mpezeshkzade/how-to-setup-react-router-v5-using-react-hooks-367g</guid>
      <description>&lt;p&gt;React Router library makes the navigation experience of the client in your web page application more joyful, but how?!&lt;/p&gt;

&lt;p&gt;React Router, indeed, prevent the page from being refreshed. Thus the blank page resulted from a refreshed page is not displayed while the user is navigating and routing through your web. This tool enables you to manipulate your web application routes through provided routing components and dynamic routing while the app is rendering.&lt;/p&gt;

&lt;p&gt;How to start:&lt;br&gt;
You need a React web app, to get started. If you don't have, install create-react-app and launch a new project using it. Then you need to install react-router-dom, applying either npm or yarn.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;save&lt;/span&gt; &lt;span class="nx"&gt;react&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;dom&lt;/span&gt;
&lt;span class="nx"&gt;yarn&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt; &lt;span class="nx"&gt;react&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;dom&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now all the required components are installed. We are enabled to add any component to the App.js inside the router to build our unique web page. All these elements are the router children to which we specify their path. For instance, I add the components of Homepage, About, and Products inside the router where one can navigate through them. Also, React Router allows us to redirect our clients by a simple click on a button. To this purpose, import the Link to your component, define an onclick function for the button and redirect it to your intended path.&lt;/p&gt;

&lt;p&gt;These are not all. There are other features in React Router. If you want to know how to install and benefit from it, join me in this YouTube video to decode the solution. I create the above-mentioned app and its components and explain all the features that we can use to improve it:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/4sRGfyUNV48"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>react</category>
      <category>reactrouter</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>BUILDING RESPONSIVE PAGES USING FLEXBOX</title>
      <dc:creator>Masoud Pezeshkzade</dc:creator>
      <pubDate>Sun, 26 Apr 2020 22:24:55 +0000</pubDate>
      <link>https://dev.to/mpezeshkzade/build-responsive-pages-using-flexbox-47gj</link>
      <guid>https://dev.to/mpezeshkzade/build-responsive-pages-using-flexbox-47gj</guid>
      <description>&lt;p&gt;&lt;b&gt;1- What is CSS FlexBox? &lt;/b&gt;&lt;br&gt;
Flexbox is a CSS3 layout model to create a responsive page enabling the elements of the container to fit with every screen size without struggling with position and float. As a direction-agnostic layout algorithm, flexbox is free from any directional constraints in contrast to the block model and inline model that are vertically-biased, and horizontally-biased respectively. While the CSS flexbox is a one-directional layout working with either a row or a column, the CSS Grid is a two-dimensional layout capable of working with both rows and columns at the same time. The former layout is mostly applied for an application or a small-layout, and the latter is suitable for large-scale layouts.&lt;br&gt;
If you want to benefit from flexbox power, this article will guide you step by step all through this way from the prerequisite concepts to flexbox features. Also, you can see &lt;a href="http://pezeshkzade.com/blog/css-grid-tutorial-for-beginners/"&gt;my blog article to learn more about CSS grid&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;2- Terminology and Core Concepts &lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Flexbox model is based on two perpendicular axes -main axis and cross axis- on which the flex items will be laid out depending on the values of the Flexbox properties. &lt;br&gt;
axis:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;b&gt;main-axis:&lt;/b&gt; The primary axis of a container is the main axis on which all the child items are laid out, and the flex-direction property defines its direction.&lt;/li&gt;
&lt;li&gt;  &lt;b&gt;cross-axis:&lt;/b&gt; The cross axis is perpendicular to the main axis. So, the cross axis is vertical if the main axis is horizontal and vice versa.
properties:&lt;/li&gt;
&lt;li&gt;  &lt;b&gt;main-start | main-end:&lt;/b&gt; These properties show where the item placement starts and where the item placement ends on the main axis&lt;/li&gt;
&lt;li&gt;  &lt;b&gt;main size:&lt;/b&gt; The main-size of the container, depending on the horizontal or vertical direction, is determined by the width or the height of its largest item, respectively.&lt;/li&gt;
&lt;li&gt;  &lt;b&gt;cross-start | cross-end:&lt;/b&gt; These properties show where the item placement starts and where the item placement ends on the main axis&lt;/li&gt;
&lt;li&gt;  &lt;b&gt;cross size:&lt;/b&gt; The cross-size of the container, depending on the horizontal or vertical direction, is determined by the width or the height of its largest item, respectively.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;b&gt;3- Flex Container &lt;/b&gt;&lt;/p&gt;

&lt;p&gt;After knowing the principle terminology of the flexbox, the next step is to create a container and set its value of display property to flex. This container is called a flex container containing the future children called flex items. The following code creates a flex container on which three flex items are laid out.&lt;br&gt;
Code start:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;
.box { display: flex; }
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"box"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;One&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;Two&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;Three
        &lt;span class="nt"&gt;&amp;lt;br&amp;gt;&lt;/span&gt;has
        &lt;span class="nt"&gt;&amp;lt;br&amp;gt;&lt;/span&gt;extra
        &lt;span class="nt"&gt;&amp;lt;br&amp;gt;&lt;/span&gt;text &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;b&gt;4- Flex Lines&lt;/b&gt;&lt;br&gt;
A hypothetical line parallels the main axis, which enables flex items to be grouped, and aligned in their container is known as the flex line. A flex container can be a single-line in which all the children are laid out in a single line or multi-line in which the items are broken into multiple lines to prevent overflow.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;5- Properties&lt;/b&gt;&lt;br&gt;
I want to categorize properties into two sections of container-level properties that deal with the placement of the items in the container, and item-level properties that manipulate individual properties of each item inside the container.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;5-1- Container-level properties&lt;/b&gt;&lt;br&gt;
These properties deal with the placement, spacing, alignment, and justification of the items inside the container. The main container-level properties are mentioned in the below:&lt;/p&gt;

&lt;p&gt;• Flex-direction: it defines the main axis direction using four possible values: &lt;br&gt;
     1- row (which is the default value, horizontal, left to right)&lt;br&gt;
     2- row-reverse (horizontal, right to left)&lt;br&gt;
     3- column (vertical, top to bottom)&lt;br&gt;
     4- column-reverse (vertical, bottom to top)&lt;/p&gt;

&lt;p&gt;As you know, the cross axis is perpendicular to the chosen main axis now.&lt;/p&gt;

&lt;p&gt;• Flex-wrap: this property defines whether the container is single-line or multi-line using three values:&lt;br&gt;
     1- nowrap (default): the single-line flex container can overflow&lt;br&gt;
     2- wrap: the flex items can wrap onto additional flex lines if there is no enough space in the first line.&lt;br&gt;
     3- wrap-reverse: Plays the same as the wrap does, but cross-start and cross-end are swapped&lt;/p&gt;

&lt;p&gt;The cross-axis direction defines the order of stacking the lines on top of each other&lt;/p&gt;

&lt;p&gt;• justify-content: You can use this property to align the flex items in the current line of the main axis through five values.&lt;br&gt;
1- flex-start (default): Packs flex items from the beginning of the line.&lt;br&gt;
2- flex-end: Packs the flex items from the end of the line.&lt;br&gt;
3- center: Packs the flex items from the center of the line.&lt;br&gt;
4- space-between: Evenly distributes flex items on the line.&lt;br&gt;
5- space-around: Evenly distributes flex items on the line, with half-size spaces on either end.&lt;/p&gt;

&lt;p&gt;• align-items: It aligns flex items on the cross axis via assigning the following values&lt;br&gt;
1- flex-start: Packs the flex items from the cross-start of the line.&lt;br&gt;
2- flex-end: Packs the flex items from the cross-end of the line.&lt;br&gt;
3- center: Packs the flex items from the center of the line&lt;br&gt;
4- baseline: Aligns the flex items by aligning their baselines.&lt;br&gt;
5- stretch (default): Stretches the flex items from the cross-start to the cross-end;&lt;/p&gt;

&lt;p&gt;• align-content: If there is extra space in the cross-axis, you can align the flex container lines within the same container applying the following values.&lt;br&gt;
1- flex-start: Packs the lines from the cross-start of the flex container.&lt;br&gt;
2- flex-end: Packs the lines from the cross-end of the flex container.&lt;br&gt;
3- center: Packs the lines rom the center of the flex container.&lt;br&gt;
4- space-between: Evenly distributes the lines in the flex container&lt;br&gt;
5- space-around: Evenly distributes the lines in the flex container, with half-size spaces on either end.&lt;br&gt;
6- stretch (default): Stretches the lines to fill the remaining space.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;5-2- Item-level properties&lt;/b&gt;&lt;br&gt;
These properties let you to manipulate the size of every individual item inside the container.&lt;br&gt;
• flex-basis: As the value of width property, the flex-basis property defines the initial size of a flex item. While the default value of auto, absolute values, and percentages are applicable, negative values are invalid for this property.&lt;br&gt;
• flex-grow: Also called as the flex-grow factor, this property could be assigned to expand the size of the items through remaining space of the container.&lt;br&gt;
• flex-shrink: The size of the flex items could be shrined to fit when their size is larger than the flex container.&lt;br&gt;
• flexbox shorthand: Three lines of coding for mentioned properties could be merged in a single line of coding by the use of the flexbox shorthand property.&lt;/p&gt;

&lt;p&gt;This article is a guide to start your first experience of creating a flexbox layout. To &lt;a href="http://pezeshkzade.com/blog/master-css-learn-how-to-build-responsive-layouts-with-css-flexbox/"&gt;Find more about CSS FlexBox and building responsive layouts with it&lt;/a&gt;, you can see full article on my blog.&lt;/p&gt;

</description>
      <category>flexbox</category>
      <category>css</category>
      <category>html</category>
      <category>responsive</category>
    </item>
    <item>
      <title>Remote working protects your programming career against Coronavirus Pandemic</title>
      <dc:creator>Masoud Pezeshkzade</dc:creator>
      <pubDate>Tue, 31 Mar 2020 20:29:20 +0000</pubDate>
      <link>https://dev.to/mpezeshkzade/http-pezeshkzade-com-blog-remote-working-protects-your-programming-career-against-covid-19-27n6</link>
      <guid>https://dev.to/mpezeshkzade/http-pezeshkzade-com-blog-remote-working-protects-your-programming-career-against-covid-19-27n6</guid>
      <description>&lt;p&gt;Nothing can stop a programmer! You can always stay productive, even on Coronavirus quarantine. It is, indeed, a perfect opportunity to work remotely. If you like it, keep doing it ;)&lt;/p&gt;

&lt;p&gt;It's so easy to start! You only need to follow a personal discipline to be welcomed to the world of remote working. Remote working is not the same as working from home on the couch while eating your breakfast. Of course, you can work at any time that you like. Just watch out for your time, though your schedule is flexible. You don't need to be an early bird, nor to work all day long. Just be wise about your timing to prevent getting behind. Create a pleasant quiet workspace. Use your ergonomic chair, stable internet connection, and second monitor, as you do in an office. &lt;/p&gt;

&lt;p&gt;Also, you are not supposed to be available for your family all day long. You should make it clear for them that you need to maintain your focus at your home office and keep your constant communication with your coworkers if you work as a team member.&lt;/p&gt;

&lt;p&gt;It’s that simple to start. The next step is to boost your productivity; touch the link below to make your remote working at COVID-19 quarantine a unique experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://pezeshkzade.com/blog/remote-working-protects-your-programming-career-against-covid-19/"&gt;http://pezeshkzade.com/blog/remote-working-protects-your-programming-career-against-covid-19/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>remoteworking</category>
      <category>covid19</category>
      <category>remote</category>
      <category>job</category>
    </item>
    <item>
      <title>My journey from learning responsive template design using CSS Grid to teaching that</title>
      <dc:creator>Masoud Pezeshkzade</dc:creator>
      <pubDate>Mon, 10 Feb 2020 14:28:43 +0000</pubDate>
      <link>https://dev.to/mpezeshkzade/my-journey-from-learning-responsive-template-design-using-css-grid-to-teach-that-moh</link>
      <guid>https://dev.to/mpezeshkzade/my-journey-from-learning-responsive-template-design-using-css-grid-to-teach-that-moh</guid>
      <description>&lt;p&gt;&lt;b&gt;The beginning&lt;/b&gt;&lt;br&gt;
A month ago, I was looking for solutions of designing a responsive website using CSS frameworks. I knew that the BootStrap framework is a well-known CSS framework that will get that power to make my website responsive. I was thinking why should I use a framework in 2020 for CSS to give me responsive functionality. These days, all websites should be responsive and responsiveness is not a luxury or fancy feature for websites. I couldn't satisfy myself that I cannot have a fully responsive website with only using pure CSS. I was thinking after many years, doesn't CSS have any builtin feature to make responsive styles? Or are not they enough mature to use them without using any additional library or framework?&lt;/p&gt;

&lt;p&gt;I checked the internet and found CSS Grid feature. I had seen several times in the other website codes or even inside Chrome Inspect Element tools while I was debugging my projects something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;   &lt;span class="nt"&gt;display&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;grid&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;But I didn't know what is the usage of this kind of display for the element. I started reading more about CSS Grid feature until I found &lt;a href="https://www.youtube.com/playlist?list=PLu8EoSxDXHP5CIFvt9-ze3IngcdAc2xKG"&gt;this CSS grid tutorial&lt;/a&gt; on youtube. The tutorials were published by Wes Bos and were so good to start with them. I watched every single video of the playlist and tried to check other CSS resources like &lt;a href="https://css-tricks.com/"&gt; CSS-Tricks &lt;/a&gt;. I learned everything about them and found how useful they are for designing responsive templates.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Browser support?&lt;/b&gt;&lt;br&gt;
Whenever you get to know a new CSS feature, you will probably think the same thing. Browser Support! I was worried about how CSS Grid works in different browsers, older versions and my question was, can I rely on it for my next projects or not! &lt;/p&gt;

&lt;p&gt;I searched and found this:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2M2gL9TU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rs638at42akay7lt2quo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2M2gL9TU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rs638at42akay7lt2quo.png" alt="CSS Grid Example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So I found browser support is quite good for it but the only problem is with CSS transitions. If you need to have transitions for changing the number of columns or rows of your grid, it is not supported yet. But in most cases, it is usable and soooooooo powerful.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Why do I think it is a powerful feature for responsiveness?&lt;/b&gt;&lt;br&gt;
The first reason is that we will get access to great tools when using Grids:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;1- FR unit!&lt;/b&gt; A new CSS length unit. &lt;a href="https://css-tricks.com/introduction-fr-css-unit/"&gt;Here you can read more about it.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;2- Auto-fit and Auto-Fill! &lt;/b&gt; for auto-sizing columns which is really useful in terms of responsive template design. &lt;a href="https://css-tricks.com/auto-sizing-columns-css-grid-auto-fill-vs-auto-fit/"&gt;Read more about it here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;3- MinMax() feature! &lt;/b&gt; You can define your column width using the minmax function to specify the maximum and minimum values.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;4- I built this example with only writing 23 lines of css code!&lt;/b&gt; You can see how responsive this is and I never used any media query to design this example!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W_l7Cu_f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/http://files.pezeshkzade.com/cssgrid2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W_l7Cu_f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/http://files.pezeshkzade.com/cssgrid2.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;    &lt;span class="nc"&gt;.albums&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="py"&gt;grid-template-columns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;repeat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;auto-fit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;minmax&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;400px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="n"&gt;fr&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
      &lt;span class="nl"&gt;align-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="py"&gt;grid-gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nc"&gt;.album&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="py"&gt;grid-template-columns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;150px&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="n"&gt;fr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="py"&gt;grid-gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#ffffff50&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;20px&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nc"&gt;.album&lt;/span&gt; &lt;span class="nt"&gt;img&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;11px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;normal&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;&lt;b&gt;CSS Grid or FlexBox?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;As I worked before with FlexBox in both React Native and CSS, I found both the same for some cases. Despite their superficial similarities, they are really different. In some cases, it is better to use FlexBox. For example, if you need to use CSS transitions and animations or need to show items in the opposite direction you have to use FlexBox.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Similar to building the whole page using table tag!&lt;/b&gt;&lt;br&gt;
In the era of responsive page design, you must not use table tag to create your page structure. If you remember those days that we used table tag, aligning page structure was a relief for us. But these days we can only use table when need to show a real table. If you need that kind of relief like before, I suggest you use the CSS Grid feature. It is somehow similar to that way of structuring the page but more powerful and better.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Say goodbye to CSS float and shitty clear:both ?&lt;/b&gt;&lt;br&gt;
Yes, I guess now it is the best time to stop using the float feature. By the power of new CSS features, we can do exactly what we were doing before with the float feature. Maybe you need to use it in some rare cases.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Tutorial ? &lt;/b&gt;&lt;br&gt;
When I learned how to use Grids, in order to master it, I defined a practical challenge for myself. I decided to re-build the main page of the YouTube page and only use CSS Grid. This practice was awesome for me and I learned a lot from it. Then I decided to make several tutorial videos about it to show you how easily you can use CSS Grids to build a responsive layout for your projects. &lt;br&gt;
You can watch two recent episodes of this tutorial and learn all in less than one hour.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;The first part: designing the head bar &lt;/b&gt;&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/1iYjntKJSH0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;b&gt;The second part: designing the left sidebar &lt;/b&gt;&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/L391ITbRLkM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Looking for more? Please subscribe to &lt;a href="https://www.youtube.com/channel/UCEoaRTl5alo9tw3A-eDJV9Q"&gt;my YouTube channel&lt;/a&gt; in order to receive notifications when new episodes are out.&lt;br&gt;
&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wAOAmZj7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://files.pezeshkzade.com/myyt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wAOAmZj7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://files.pezeshkzade.com/myyt.png" alt="Programming with Masoud"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>State management in ReactJS using Redux library</title>
      <dc:creator>Masoud Pezeshkzade</dc:creator>
      <pubDate>Thu, 28 Nov 2019 09:07:58 +0000</pubDate>
      <link>https://dev.to/mpezeshkzade/state-management-in-reactjs-using-redux-library-57o1</link>
      <guid>https://dev.to/mpezeshkzade/state-management-in-reactjs-using-redux-library-57o1</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--heipuOTP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://redux.js.org/img/redux.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--heipuOTP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://redux.js.org/img/redux.svg"&gt;&lt;/a&gt;&lt;br&gt;
There are several options for managing state inside ReactJs projects. You may have heard about libraries like &lt;a href="https://redux.js.org/"&gt;Redux&lt;/a&gt;, &lt;a href="https://reactjs.org/docs/context.html"&gt;Context API&lt;/a&gt;, &lt;a href="https://github.com/mobxjs/mobx"&gt;Mobx&lt;/a&gt; and &lt;a href="https://github.com/jamiebuilds/unstated#introducing-unstated"&gt;Unstated&lt;/a&gt;. In this article we are going to describe more about state management and Redux. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;My story:&lt;/b&gt;&lt;br&gt;
When I started working with React Native, as a native mobile developer, I found states scary and weird. In Java, we have &lt;a href="https://developer.android.com/reference/android/content/Intent"&gt;Intents&lt;/a&gt; and &lt;a href="https://developer.android.com/reference/android/app/Application.html"&gt;Application&lt;/a&gt; class to send data between pages and store global variables. But none of them exists in React Native. Plus, In my first app, I didn't know why should we use a third-party to manage the application state while we have built-in state API. At that moment I just followed some tutorials about Redux and its implementation in React projects. Now after developing several applications with React and state managers, I found how state management can be useful to make our project structure better, project lines of code lower and your project more understandable for other developers. The thing is in big-scale projects, using state managers is a must! &lt;br&gt;
&lt;i&gt;&lt;br&gt;
I know that at first, maybe it will be wired and scary for you if you don't have a strong javascript understanding yet, but try to use it like me and don't blame yourself if you could not understand it deeply. Even today that I am writing this blog post, state management, and Redux is not easy peasy for me but I have to use it. I hope this article helps you to understand Redux better. &lt;br&gt;
&lt;/i&gt;&lt;br&gt;
&lt;b&gt;Redux&lt;/b&gt;&lt;br&gt;
Redux is the first library that solved state management in React. It is so popular among React developers. In Redux we have several key elements:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;1- Store:&lt;/b&gt; all our data will keep here.&lt;br&gt;
&lt;b&gt;2- Actions:&lt;/b&gt; they let us to send our data to Redux. Technically they are simple javascript objects that must have a type and can include several key-value data.&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;LOGIN_SUCCESS&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user token here ...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We can also have &lt;b&gt;action creators&lt;/b&gt; for ease:&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;function&lt;/span&gt; &lt;span class="nx"&gt;loginSuccess&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;token&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;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;LOGIN_SUCCESS&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nx"&gt;token&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;logout&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;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;LOGOUT&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;b&gt;3- Dispatch:&lt;/b&gt; it is a redux API that runs our actions. In fact, in order to save our data, we should run our actions using dispatch API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&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;loginSuccess&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;//dispatch api only accept javascript objects&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;b&gt;4- Reducers:&lt;/b&gt; they are just pure javascript functions that accept actions as their argument and decide what to save in store when an action is sent to them.&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;defaultState&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;token&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="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;defaultState&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="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="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;LOGIN_SUCCESS&lt;/span&gt;&lt;span class="dl"&gt;"&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="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="na"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;token&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;token&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;LOGOUT&lt;/span&gt;&lt;span class="dl"&gt;"&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="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="na"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;token&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="nl"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;state&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;** &lt;b&gt;Keep in mind that you must not have any side effect operation inside your reducer function. For example, you cannot fetch data from your API inside your reducer function.&lt;/b&gt; If you are looking for more detail about &lt;a href="https://www.freecodecamp.org/news/what-is-a-pure-function-in-javascript-acb887375dfe/"&gt;PURE functions&lt;/a&gt; in javascript, please check this blog post.&lt;/p&gt;

&lt;p&gt;** &lt;b&gt;Writing only one general reducer?&lt;/b&gt; Redux accepts only one reducer but it is a bad practice to have a big general reducer function. It is better to write reducers based on their functionalities. For instance, we can have a reducer for users' stuff and one another for notifications and so on. At the end of the article, you see how we can use combineReducer API to merge all reducers to one.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Connecting your app to Redux&lt;/b&gt;&lt;br&gt;
The next part is installing the Redux library and connecting your app to it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;save&lt;/span&gt; &lt;span class="nx"&gt;redux&lt;/span&gt; &lt;span class="nx"&gt;react&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;redux&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;After installing libraries open index.js file. At first, it should look like it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ReactDOM&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-dom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./index.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;serviceWorker&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./serviceWorker&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="c1"&gt;// If you want your app to work offline and load faster, you can change&lt;/span&gt;
&lt;span class="c1"&gt;// unregister() to register() below. Note this comes with some pitfalls.&lt;/span&gt;
&lt;span class="c1"&gt;// Learn more about service workers: https://bit.ly/CRA-PWA&lt;/span&gt;
&lt;span class="nx"&gt;serviceWorker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;unregister&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;


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



&lt;p&gt;We need to change it to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ReactDOM&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-dom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./index.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;serviceWorker&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./serviceWorker&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&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;createStore&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;combineReducers&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="s1"&gt;redux&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;//1&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./redux/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;//2&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;Provider&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="s1"&gt;react-redux&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;//3&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;reducers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;combineReducers&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;notifications&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="c1"&gt;//4&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;reducers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//5&lt;/span&gt;


&lt;span class="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Provider&lt;/span&gt; &lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="o"&gt;=&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="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Provider&amp;gt;, document.getElementById&lt;/span&gt;&lt;span class="se"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;'root'&lt;/span&gt;&lt;span class="se"&gt;))&lt;/span&gt;&lt;span class="sr"&gt;; {/&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;}
&lt;/span&gt;
&lt;span class="c1"&gt;// If you want your app to work offline and load faster, you can change&lt;/span&gt;
&lt;span class="c1"&gt;// unregister() to register() below. Note this comes with some pitfalls.&lt;/span&gt;
&lt;span class="c1"&gt;// Learn more about service workers: https://bit.ly/CRA-PWA&lt;/span&gt;
&lt;span class="nx"&gt;serviceWorker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;unregister&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

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



&lt;p&gt;&lt;b&gt; Line 1: &lt;/b&gt; importing createStore and combineReducers API's from redux package.&lt;br&gt;
&lt;b&gt; Line 2: &lt;/b&gt; importing our reducers. remember we have only one reducer but you can have as many as you need.&lt;br&gt;
&lt;b&gt; Line 3: &lt;/b&gt; importing Provider component. The provider component lets us connect our app to our store.&lt;br&gt;
&lt;b&gt; Line 4: &lt;/b&gt; combining all reducers to one reducer using combineReducer API. In the case of having several reducers we should write like this:&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;reducers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;combineReducers&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;notifications&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;test1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;test2&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;

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



&lt;p&gt;&lt;b&gt; Line 5: &lt;/b&gt; Creating our store based on main reducer.&lt;br&gt;
&lt;b&gt; Line 6: &lt;/b&gt; Putting  component inside .&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Read and write state&lt;/b&gt;&lt;br&gt;
Now everything is ready and we can read and write our states. You only need to connect your component to the Redux to complete your job.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;logo&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./logo.svg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&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;connect&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="s1"&gt;react-redux&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&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;login&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;logout&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="s1"&gt;./redux/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;


  &lt;span class="nx"&gt;componentDidMount&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="nx"&gt;setTimeout&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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;login&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;token here...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;//1&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="nx"&gt;setTimeout&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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;logout&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;//2&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;header&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App-header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;logo&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App-logo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;logo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nx"&gt;USER&lt;/span&gt; &lt;span class="nx"&gt;TOKEN&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;auth&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&amp;gt;} {/&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;}
&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/header&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&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;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;mapStateToProps&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="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;users&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;users&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;mapDispatchToProps&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;login&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;logout&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;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;mapStateToProps&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;mapDispatchToProps&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;b&gt; Line 1 &amp;amp; 2: &lt;/b&gt; here we are calling our actions. Redux will send our actions to dispatch API and then passes it to our reducer...&lt;/p&gt;

&lt;p&gt;&lt;b&gt; Line 3: &lt;/b&gt; reading state from redux. Our component will be re-rendered when the user data changes.&lt;br&gt;
&lt;b&gt; Line 4: &lt;/b&gt; connecting our App component and then export it.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Github repository of this tutorial&lt;/b&gt;&lt;br&gt;
Developers like to learn things through code examples. If you are looking for a working demo, you can check out my &lt;a href="https://github.com/mdeveloper20/reactReminder/tree/normal-redux"&gt;React Redux Github branch here&lt;/a&gt;&lt;a&gt;&lt;/a&gt;. It is a basic react application that I implemented Redux in it. The reason why I made this repository is that it's gonna remind me implementation of all the useful libraries in Redux instead of looking on the internet for it. That is why I name it &lt;a href="https://github.com/mdeveloper20/reactReminder"&gt;React Reminder&lt;/a&gt;. You can use this repo or you can have yours.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Summery&lt;/b&gt;&lt;br&gt;
Redux is one of the useful libraries to manage your React application state. There are other options for you to do state management in your application like Context API. It is worth to take a look at other options before using Redux. In this article, we talked about how important state management is and showed how you can implement one of them in your projects step by step. &lt;br&gt;
For more information about Redux, you can read its &lt;a href="https://redux.js.org"&gt;official documentation&lt;/a&gt;. If you are curious to learn more about Redux, I recommend you take a look at it's middlewares like &lt;a href="https://github.com/reduxjs/redux-thunk"&gt;Redux-Thunk&lt;/a&gt; and &lt;br&gt;
 specially &lt;a href="https://redux-saga.js.org/docs/introduction/BeginnerTutorial.html"&gt;Redux-Saga&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/6sOqeRB39Eg"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>redux</category>
      <category>reactnative</category>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to rapidly update your React Native android project using Code Push without app store upload</title>
      <dc:creator>Masoud Pezeshkzade</dc:creator>
      <pubDate>Fri, 08 Nov 2019 08:16:57 +0000</pubDate>
      <link>https://dev.to/mpezeshkzade/how-to-rapidly-update-your-react-native-android-project-using-code-push-without-app-store-upload-5561</link>
      <guid>https://dev.to/mpezeshkzade/how-to-rapidly-update-your-react-native-android-project-using-code-push-without-app-store-upload-5561</guid>
      <description>&lt;p&gt;These days React Native has become so popular among developers. React Native lets us to develop mobile applications that technically are able to run on Android and IOS platforms. &lt;/p&gt;

&lt;p&gt;When you built your app and everything is ready for publishing it,&lt;br&gt;
you have to submit your app in the app store and wait until they review and publish it for you. There are some cases that you need immediately update your app. For example, there is a critical bug in your release version.&lt;/p&gt;

&lt;p&gt;In this case, you should build another version and submit it and wait for the review process. Plus, most users do not update their applications immediately. So these users will face errors and unluckily some of them will write bad reviews for your application. &lt;/p&gt;

&lt;p&gt;Fortunately, Code Push library has solved this problem for our react native developers. While your application support code push, there is a way to update your app without sending any file to the app store and even your users don't need to update your application.&lt;/p&gt;

&lt;p&gt;All the instructions for implementing Code Push library into your project have been described in my youtube channel. &lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Jo7AV5etOsA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>android</category>
      <category>reactnative</category>
      <category>codepush</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
