<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ashwin Mothilal</title>
    <description>The latest articles on Forem by Ashwin Mothilal (@ashwin_mothilal).</description>
    <link>https://forem.com/ashwin_mothilal</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%2F190522%2F490f00c7-617f-4149-8377-8edb600d4581.jpg</url>
      <title>Forem: Ashwin Mothilal</title>
      <link>https://forem.com/ashwin_mothilal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ashwin_mothilal"/>
    <language>en</language>
    <item>
      <title>How to add Shimmering effect to your React Native App using reanimated?</title>
      <dc:creator>Ashwin Mothilal</dc:creator>
      <pubDate>Sat, 29 Aug 2020 14:09:58 +0000</pubDate>
      <link>https://forem.com/ashwin_mothilal/how-to-add-shimmering-effect-to-your-react-native-app-using-reanimated-2llk</link>
      <guid>https://forem.com/ashwin_mothilal/how-to-add-shimmering-effect-to-your-react-native-app-using-reanimated-2llk</guid>
      <description>&lt;p&gt;Today we will look at how to implement the Shimmering effect on a React Native App using the library &lt;a href="https://github.com/Ashwin-Mothilal/react-native-js-shimmer-placeholder" rel="noopener noreferrer"&gt;react-native-js-shimmer-placeholder&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this library?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;This is my first library published on npm and I would like to do something cool, so I built this&lt;/li&gt;
&lt;li&gt;There was no shimmering effect library using reanimated, yes this library uses &lt;code&gt;react-native-reanimated&lt;/code&gt; v1&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Example App
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft8p44df7u7k9pgzeirow.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft8p44df7u7k9pgzeirow.gif" alt="Example GIF"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding Shimmering effect to the View
&lt;/h2&gt;

&lt;p&gt;Let us get the stone rolling right away:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

import {
  ViewPlaceholder,
  Direction,
} from "react-native-js-shimmer-placeholder";

&amp;lt;ViewPlaceholder
  width={100}
  height={100}
  style={{
    borderWidth: 1,
    borderColor: "lightgrey",
    borderRadius: 50,
  }}
  direction={Direction.UP}
  gradientContainerStyle={{ borderRadius: 50 }}
&amp;gt;
  &amp;lt;View
    style={{
      height: 100,
      backgroundColor: "#318fb5",
      borderRadius: 50,
      alignItems: "center",
      justifyContent: "center",
    }}
  &amp;gt;
    &amp;lt;Text style={{ fontSize: 30 }}&amp;gt;🚀&amp;lt;/Text&amp;gt;
  &amp;lt;/View&amp;gt;
&amp;lt;/ViewPlaceholder&amp;gt;


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Step 1
&lt;/h3&gt;

&lt;p&gt;Import the &lt;code&gt;ViewPlaceholder&lt;/code&gt; from the &lt;code&gt;react-native-js-shimmer-placeholder&lt;/code&gt;, then decide the direction you want the Shimmering effect to flow.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default, it will move towards the RIGHT direction.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Step 2
&lt;/h3&gt;

&lt;p&gt;Now pass the &lt;code&gt;width&lt;/code&gt; or &lt;code&gt;height&lt;/code&gt; to the ViewPlaceholder which depends upon the direction.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For vertical effect pass the &lt;code&gt;height&lt;/code&gt; and for horizontal effect pass the &lt;code&gt;width&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Step 3
&lt;/h3&gt;

&lt;p&gt;Render the contents inside the &lt;code&gt;ViewPlaceholder&lt;/code&gt;. You can also add styles to the &lt;code&gt;ViewPlaceholder&lt;/code&gt; and the Gradient container style to customise the View as you wish.&lt;/p&gt;
&lt;h2&gt;
  
  
  Adding Shimmering effect to the Text
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

import { TextPlaceholder } from "react-native-js-shimmer-placeholder";

&amp;lt;TextPlaceholder
  show={true}
  textStyle={{ fontSize: 24, fontWeight: "bold" }}
  style={{
    flex: 1,
    width: "100%",
    justifyContent: "center",
    alignItems: "center",
  }}
  textColor={"#318fb5"}
&amp;gt;
  Hey React Native devs!
&amp;lt;/TextPlaceholder&amp;gt;


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Step 1
&lt;/h3&gt;

&lt;p&gt;Import the &lt;code&gt;TextPlaceholder&lt;/code&gt; from the &lt;code&gt;react-native-js-shimmer-placeholder&lt;/code&gt;, then decide the direction you want the Shimmering effect to flow. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By default, it will move towards the RIGHT direction.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Step 2
&lt;/h3&gt;

&lt;p&gt;Just pass the direction. The &lt;code&gt;TextPlaceholder&lt;/code&gt; doesn't necessarily need a width/height as a fixed value, It can also be percentages or flex as long as the parent has the dimensions&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 3
&lt;/h3&gt;

&lt;p&gt;Render the &lt;code&gt;TextPlaceholder&lt;/code&gt; inside any View as you wish. You can also pass &lt;code&gt;textStyle&lt;/code&gt; and other text attributes as you would do for a Text component from RN Library. You can also pass the style for the mask component and the first child view of the mask container.&lt;/p&gt;



&lt;p&gt;These are the initial effects for this library. Please feel free to try out the example app included in the Repo.&lt;/p&gt;

&lt;p&gt;If you would like to know about all the props and customisations please check the documentation link below. Any comments are welcome.&lt;/p&gt;




&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Ashwin-Mothilal" rel="noopener noreferrer"&gt;
        Ashwin-Mothilal
      &lt;/a&gt; / &lt;a href="https://github.com/Ashwin-Mothilal/react-native-js-shimmer-placeholder" rel="noopener noreferrer"&gt;
        react-native-js-shimmer-placeholder
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Shimmering effect using react-native-reanimated, react-native-linear-gradient and react-native-masked-view
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;react-native-js-shimmer-placeholder&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;Shimmering effect using &lt;a href="https://github.com/software-mansion/react-native-reanimated" rel="noopener noreferrer"&gt;react-native-reanimated&lt;/a&gt;, &lt;a href="https://github.com/react-native-community/react-native-linear-gradient" rel="noopener noreferrer"&gt;react-native-linear-gradient&lt;/a&gt; and &lt;a href="https://github.com/react-native-community/react-native-masked-view" rel="noopener noreferrer"&gt;react-native-masked-view&lt;/a&gt;&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Demo&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/Ashwin-Mothilal/react-native-js-shimmer-placeholder/blob/master/example.gif?raw=true"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2FAshwin-Mothilal%2Freact-native-js-shimmer-placeholder%2Fraw%2Fmaster%2Fexample.gif%3Fraw%3Dtrue" alt="Demo of React Native JS Shimmer Placeholder"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Installation&lt;/h2&gt;
&lt;/div&gt;

&lt;p&gt;Make sure you have already installed &lt;a href="https://github.com/software-mansion/react-native-reanimated" rel="noopener noreferrer"&gt;react-native-reanimated&lt;/a&gt;, &lt;a href="https://github.com/react-native-community/react-native-linear-gradient" rel="noopener noreferrer"&gt;react-native-linear-gradient&lt;/a&gt; and &lt;a href="https://github.com/react-native-community/react-native-masked-view" rel="noopener noreferrer"&gt;react-native-masked-view&lt;/a&gt; or install it from their links&lt;/p&gt;

&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;npm install react-native-js-shimmer-placeholder --save
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;or using yarn&lt;/p&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;&lt;pre class="notranslate"&gt;&lt;code&gt;yarn add react-native-js-shimmer-placeholder
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Usage&lt;/h2&gt;

&lt;/div&gt;

&lt;p&gt;To use shimmering effect for View&lt;/p&gt;

&lt;div class="highlight highlight-source-js notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-k"&gt;import&lt;/span&gt; &lt;span class="pl-kos"&gt;{&lt;/span&gt;
  &lt;span class="pl-v"&gt;ViewPlaceholder&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt;
  &lt;span class="pl-v"&gt;Direction&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt;
&lt;span class="pl-kos"&gt;}&lt;/span&gt; &lt;span class="pl-k"&gt;from&lt;/span&gt; &lt;span class="pl-s"&gt;"react-native-js-shimmer-placeholder"&lt;/span&gt;&lt;span class="pl-kos"&gt;;&lt;/span&gt;
&lt;span class="pl-c1"&gt;&amp;lt;&lt;/span&gt;&lt;span class="pl-ent"&gt;ViewPlaceholder&lt;/span&gt;
  &lt;span class="pl-c1"&gt;show&lt;/span&gt;&lt;span class="pl-c1"&gt;=&lt;/span&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt;&lt;span class="pl-c1"&gt;true&lt;/span&gt;&lt;span class="pl-kos"&gt;}&lt;/span&gt;
  &lt;span class="pl-c1"&gt;width&lt;/span&gt;&lt;span class="pl-c1"&gt;=&lt;/span&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt;&lt;span class="pl-c1"&gt;100&lt;/span&gt;&lt;span class="pl-kos"&gt;}&lt;/span&gt;
  &lt;span class="pl-c1"&gt;height&lt;/span&gt;&lt;span class="pl-c1"&gt;=&lt;/span&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt;&lt;span class="pl-c1"&gt;100&lt;/span&gt;&lt;span class="pl-kos"&gt;}&lt;/span&gt;
  &lt;span class="pl-c1"&gt;style&lt;/span&gt;&lt;span class="pl-c1"&gt;=&lt;/span&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt;
    &lt;span class="pl-c1"&gt;borderWidth&lt;/span&gt;: &lt;span class="pl-c1"&gt;1&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt;
    &lt;span class="pl-c1"&gt;borderColor&lt;/span&gt;: &lt;span class="pl-s"&gt;"lightgrey"&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt;
    &lt;span class="pl-c1"&gt;borderRadius&lt;/span&gt;: &lt;span class="pl-c1"&gt;50&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt;
  &lt;span class="pl-kos"&gt;}&lt;/span&gt;&lt;span class="pl-kos"&gt;}&lt;/span&gt;
  &lt;span class="pl-c1"&gt;direction&lt;/span&gt;&lt;span class="pl-c1"&gt;=&lt;/span&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt;&lt;span class="pl-v"&gt;Direction&lt;/span&gt;&lt;span class="pl-kos"&gt;.&lt;/span&gt;&lt;span class="pl-c1"&gt;UP&lt;/span&gt;&lt;span class="pl-kos"&gt;}&lt;/span&gt;
  &lt;span class="pl-c1"&gt;gradientContainerStyle&lt;/span&gt;&lt;span class="pl-c1"&gt;=&lt;/span&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt; &lt;span class="pl-c1"&gt;borderRadius&lt;/span&gt;: &lt;span class="pl-c1"&gt;50&lt;/span&gt; &lt;span class="pl-kos"&gt;}&lt;/span&gt;&lt;span class="pl-kos"&gt;}&lt;/span&gt;
&lt;span class="pl-c1"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="pl-c1"&gt;&amp;lt;&lt;/span&gt;&lt;span class="pl-ent"&gt;View&lt;/span&gt;
    &lt;span class="pl-c1"&gt;style&lt;/span&gt;&lt;span class="pl-c1"&gt;=&lt;/span&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt;
      &lt;span class="pl-c1"&gt;height&lt;/span&gt;: &lt;span class="pl-c1"&gt;100&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt;
      &lt;span class="pl-c1"&gt;backgroundColor&lt;/span&gt;: &lt;span class="pl-s"&gt;"#318fb5"&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt;
      &lt;span class="pl-c1"&gt;borderRadius&lt;/span&gt;: &lt;span class="pl-c1"&gt;50&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt;
      &lt;span class="pl-c1"&gt;alignItems&lt;/span&gt;: &lt;span class="pl-s"&gt;"center"&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt;
      &lt;span class="pl-c1"&gt;justifyContent&lt;/span&gt;: &lt;span class="pl-s"&gt;"center"&lt;/span&gt;&lt;span class="pl-kos"&gt;,&lt;/span&gt;
    &lt;span class="pl-kos"&gt;}&lt;/span&gt;&lt;span class="pl-kos"&gt;}&lt;/span&gt;
  &lt;span class="pl-c1"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="pl-c1"&gt;&amp;lt;&lt;/span&gt;&lt;span class="pl-ent"&gt;Text&lt;/span&gt; &lt;span class="pl-c1"&gt;style&lt;/span&gt;&lt;span class="pl-c1"&gt;=&lt;/span&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt;&lt;span class="pl-kos"&gt;{&lt;/span&gt; &lt;span class="pl-c1"&gt;fontSize&lt;/span&gt;: &lt;span class="pl-c1"&gt;30&lt;/span&gt; &lt;span class="pl-kos"&gt;}&lt;/span&gt;&lt;span class="pl-kos"&gt;}&lt;/span&gt;&lt;span class="pl-c1"&gt;&amp;gt;&lt;/span&gt;🚀&lt;span class="pl-c1"&gt;&amp;lt;&lt;/span&gt;&lt;/pre&gt;…
&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Ashwin-Mothilal/react-native-js-shimmer-placeholder" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;



</description>
      <category>reactnative</category>
    </item>
    <item>
      <title>Difference between Pure Component and Functional Component 🥳</title>
      <dc:creator>Ashwin Mothilal</dc:creator>
      <pubDate>Sun, 12 Jan 2020 14:54:25 +0000</pubDate>
      <link>https://forem.com/ashwin_mothilal/difference-between-pure-component-and-functional-component-51mi</link>
      <guid>https://forem.com/ashwin_mothilal/difference-between-pure-component-and-functional-component-51mi</guid>
      <description>&lt;p&gt;Hey devs 🌍&lt;/p&gt;

&lt;p&gt;In today's post, I want to share my knowledge and understanding of &lt;strong&gt;Pure Component&lt;/strong&gt; and &lt;strong&gt;Functional Component&lt;/strong&gt;. How they both differ and when to use those and how it reduces the number of re-renders for a Component.&lt;/p&gt;

&lt;p&gt;If you end up in this post, then you already know-how &lt;strong&gt;React&lt;/strong&gt; works.&lt;/p&gt;

&lt;p&gt;Now we will see what are those mentioned above.&lt;/p&gt;

&lt;h1&gt;
  
  
  What the heck is Pure Component!🤯
&lt;/h1&gt;




&lt;p&gt;The Pure Component is similar to a Component where PureComponent has it's own implementation of &lt;code&gt;shouldComponentUpdate&lt;/code&gt; and it only compares shallow props and state and you cannot implement your own &lt;code&gt;shouldComponentUpdate&lt;/code&gt; in it.&lt;/p&gt;

&lt;p&gt;If you have complex data structures in your state and props then your Pure Component will not re-render when the state or props change which you don't want to happen and you will get the wrong output.&lt;/p&gt;

&lt;h3&gt;
  
  
  When to use them? 🤔
&lt;/h3&gt;

&lt;p&gt;When your Pure Component gives the same render for the same values of Props and State of a Pure Component.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;

&lt;p&gt;If you have a list component and you're building a list item component then you can use Pure Component which means your item component won't re-render if you change anything unrelated to the Pure Component which will increase the performance of the list.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Basic Code:&lt;/em&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

class PC extends PureComponent {
    render(){
        return &amp;lt;div&amp;gt;This is Pure Component&amp;lt;/div&amp;gt;
    }
}


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

&lt;/div&gt;
&lt;h1&gt;
  
  
  What is Functional Component?
&lt;/h1&gt;



&lt;p&gt;Functional Component is a normal function where you return a View/div. They don't have any React life cycle methods. It's just a JavaScript function. It will re-render whenever your parent component re-renders, which means unwanted re-renders which you won't see visually. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Basic Code:&lt;/em&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

function FC(){
    return (
        &amp;lt;div&amp;gt;This is a Functional Component&amp;lt;/div&amp;gt;
    );
}


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

&lt;/div&gt;
&lt;h1&gt;
  
  
  Demo React App
&lt;/h1&gt;



&lt;p&gt;I have created a &lt;a href="https://github.com/Ashwin-Mothilal/articleone" rel="noopener noreferrer"&gt;repository&lt;/a&gt; to understand the differences between those.&lt;/p&gt;

&lt;p&gt;I have an initial state&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

this.state = {
   dummyState: new Date().valueOf()
};


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

&lt;/div&gt;

&lt;p&gt;I have a parent component which has rendered three different child components named: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pure Component&lt;/li&gt;
&lt;li&gt;Functional Component&lt;/li&gt;
&lt;li&gt;Component&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

 &amp;lt;PureChild /&amp;gt;
 &amp;lt;FunctionalChild /&amp;gt;
 &amp;lt;ComponentChild /&amp;gt;


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

&lt;/div&gt;

&lt;p&gt;Now I'm setting an Interval in &lt;strong&gt;componentDidMount&lt;/strong&gt; in Parent Component&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

this.interval = setInterval(() =&amp;gt; {
    this.setState({
      dummyState: new Date().valueOf()
    });
}, 1000);


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

&lt;/div&gt;

&lt;p&gt;Note I haven't passed the state to the child components.&lt;/p&gt;

&lt;p&gt;I have printed the latest &lt;code&gt;Date().valueOf()&lt;/code&gt; in all the child component, you can see those visually. &lt;br&gt;
If you run the React App you will see the values updating in the Child Components except for the Pure Component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now the Pure Component doesn't re-render because of the props and state in it (actually we don't have any) don't change but the Component and the Functional Component re-renders whenever the parent component re-renders.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FpSPCIUw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FpSPCIUw.gif" alt="Final Output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;




&lt;p&gt;It's good to use Pure Component to increase the performance but when to use the  Functional Component, I didn't say that yet, you can just use it inside the Pure Component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You can use &lt;a href="//React.memo"&gt;React.memo&lt;/a&gt; for functional components it's similar to Pure Component&lt;/li&gt;
&lt;li&gt;Implement &lt;code&gt;shouldComponentUpdate&lt;/code&gt; with Component to avoid unnecessary re-renders&lt;/li&gt;
&lt;/ol&gt;

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