<?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: SAIKAT BISHAL</title>
    <description>The latest articles on DEV Community by SAIKAT BISHAL (@saikatbishal).</description>
    <link>https://dev.to/saikatbishal</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%2F482079%2F225dba1e-cdf4-45af-9623-63fd26f777ad.png</url>
      <title>DEV Community: SAIKAT BISHAL</title>
      <link>https://dev.to/saikatbishal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saikatbishal"/>
    <language>en</language>
    <item>
      <title>Hey guys, Look. I found a really cool and very useful tool for content creators, especially in the tech space. Now you'll know how many times your content was plagiarised and by whom. 
I gave it a shot and found a 34% generic match with another.</title>
      <dc:creator>SAIKAT BISHAL</dc:creator>
      <pubDate>Sun, 07 Dec 2025 04:25:15 +0000</pubDate>
      <link>https://dev.to/saikatbishal/hey-guys-look-i-found-a-really-cool-and-very-useful-tool-for-content-creators-especially-in-the-9n4</link>
      <guid>https://dev.to/saikatbishal/hey-guys-look-i-found-a-really-cool-and-very-useful-tool-for-content-creators-especially-in-the-9n4</guid>
      <description>&lt;p&gt;

&lt;/p&gt;
&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/stokry/i-found-a-copy-of-my-blog-post-online-heres-the-tool-i-built-to-track-every-plagiarized-version-18je" class="crayons-story__hidden-navigation-link"&gt;I Found a Copy of My Blog Post Online — Here’s the Tool I Built to Track Every Plagiarized Version&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/stokry" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F160180%2Fbe40180c-377f-457b-a5ae-0ec95a66fe2b.png" alt="stokry profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/stokry" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Stokry
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Stokry
                
              
              &lt;div id="story-author-preview-content-3085725" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/stokry" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F160180%2Fbe40180c-377f-457b-a5ae-0ec95a66fe2b.png" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Stokry&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/stokry/i-found-a-copy-of-my-blog-post-online-heres-the-tool-i-built-to-track-every-plagiarized-version-18je" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Dec 5 '25&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/stokry/i-found-a-copy-of-my-blog-post-online-heres-the-tool-i-built-to-track-every-plagiarized-version-18je" id="article-link-3085725"&gt;
          I Found a Copy of My Blog Post Online — Here’s the Tool I Built to Track Every Plagiarized Version
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/webdev"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;webdev&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/productivity"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;productivity&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/ai"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;ai&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/javascript"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;javascript&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/stokry/i-found-a-copy-of-my-blog-post-online-heres-the-tool-i-built-to-track-every-plagiarized-version-18je" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;7&lt;span class="hidden s:inline"&gt; reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/stokry/i-found-a-copy-of-my-blog-post-online-heres-the-tool-i-built-to-track-every-plagiarized-version-18je#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              1&lt;span class="hidden s:inline"&gt; comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            2 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;




</description>
      <category>webdev</category>
      <category>productivity</category>
      <category>ai</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Navigating the React Redux toolkit as a Frontend developer</title>
      <dc:creator>SAIKAT BISHAL</dc:creator>
      <pubDate>Wed, 31 Jan 2024 06:56:24 +0000</pubDate>
      <link>https://dev.to/saikatbishal/navigating-the-react-redux-toolkit-as-a-frontend-developer-3p9h</link>
      <guid>https://dev.to/saikatbishal/navigating-the-react-redux-toolkit-as-a-frontend-developer-3p9h</guid>
      <description>&lt;p&gt;In the vast landscape of frontend development, navigating the intricacies of state management can often feel like deciphering a complex narrative. Enter Redux, a steadfast storyteller in our coding adventures, unraveling the tale of centralised state management. As we embark on this journey, the narrative takes an exciting turn with the introduction of Redux Toolkit – a robust toolbox designed to be the maestro orchestrating the symphony of state in React applications.&lt;/p&gt;

&lt;p&gt;Redux, as our seasoned storyteller, has long been the go-to solution for managing the ever-evolving state of complex React applications. It weaves a story of predictability and clarity, providing a structured approach that, while powerful, can sometimes lead to verbose and boilerplate-heavy code. This is where the Redux Toolkit emerges as a transformative force, akin to a trusty companion offering a simplified and more intuitive path through the intricate tapestry of Redux.&lt;/p&gt;

&lt;p&gt;Picture Redux Toolkit as a well-equipped toolbox, stocked with utilities that redefine our approach to state management. At the heart of this toolbox is configureStore, a function that streamlines the creation of Redux stores with sensible defaults. It's like having a seasoned guide ensuring we start our journey with the right map and provisions.&lt;/p&gt;

&lt;p&gt;But the toolkit doesn't stop there; &lt;/p&gt;

&lt;h2&gt;
  
  
  CreateSlice
&lt;/h2&gt;

&lt;p&gt;createSlice introduces a paradigm shift in structuring our state, actions, and reducers. It's as if we've found a magical quill that effortlessly writes organized and maintainable code, eliminating the need for boilerplate, and allowing us to focus on the essence of our application logic.&lt;/p&gt;

&lt;p&gt;As the narrative unfolds, createAsyncThunk steps onto the stage, addressing the challenge of asynchronous operations in a manner reminiscent of a skilled conductor orchestrating a symphony. Fetching data from APIs becomes as seamless as a well-coordinated musical composition, enhancing the overall harmony of our application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let me untangle the nature of redux chapter by chapter
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Chapter 1: Demystifying Redux
&lt;/h3&gt;

&lt;p&gt;Redux serves as our reliable storyteller, narrating the tale of centralized state management. Enter Redux Toolkit, our toolbox for simplifying the intricacies of Redux, making the process more intuitive and efficient.&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="c1"&gt;// Importing Redux&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="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="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Initial State&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="c1"&gt;// Your initial state properties here&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// Reducer&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rootReducer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&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;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="c1"&gt;// Reducer logic based on action types&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="c1"&gt;// Creating the Redux 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="nf"&gt;createStore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;rootReducer&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Example Dispatch&lt;/span&gt;
&lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dispatch&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="s1"&gt;SOME_ACTION&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;data&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;h3&gt;
  
  
  Chapter 2: The Redux Toolkit Toolbox
&lt;/h3&gt;

&lt;p&gt;Imagine Redux Toolkit as the go-to toolkit, providing utilities like configureStore, createSlice, and createAsyncThunk for creating Redux stores, reducers, and handling asynchronous actions. This toolkit transforms verbose code into concise, readable expressions.&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="c1"&gt;// Importing Redux Toolkit&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;configureStore&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;@reduxjs/toolkit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Initial State&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="c1"&gt;// Your initial state properties here&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// Reducer&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rootReducer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&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;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="c1"&gt;// Reducer logic based on action types&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="c1"&gt;// Creating the Redux Store with Toolkit&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="nf"&gt;configureStore&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;reducer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;rootReducer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// Additional configuration options&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Chapter 3: Slicing Through Complexity
&lt;/h3&gt;

&lt;p&gt;Creating slices with createSlice is akin to neatly dividing a cake. Each slice encapsulates a part of the application's state, alongside the necessary actions and reducers. This approach simplifies organization and enhances code maintainability.&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="c1"&gt;// Importing createSlice from Redux Toolkit&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;createSlice&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;@reduxjs/toolkit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Initial State&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="c1"&gt;// Your initial state properties here&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// Creating a Slice&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mySlice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createSlice&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;myFeature&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="na"&gt;reducers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Reducer logic specific to this slice&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Exporting Actions&lt;/span&gt;
&lt;span class="k"&gt;export&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;actions&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;mySlice&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Chapter 4: Dispatching Actions with Ease
&lt;/h3&gt;

&lt;p&gt;In this chapter, we explore the simplicity of dispatching actions. With Redux Toolkit, the need for separate action creators diminishes, allowing us to dispatch actions effortlessly, streamlining communication with reducers.&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="c1"&gt;// Importing useDispatch from React Redux&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;useDispatch&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="c1"&gt;// Dispatching Actions&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt; &lt;span class="o"&gt;=&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="nx"&gt;dispatch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useDispatch&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;handleClick&lt;/span&gt; &lt;span class="o"&gt;=&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="nf"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;someAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;data&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="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="c1"&gt;// Your component JSX&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;h3&gt;
  
  
  Chapter 5: Asynchronous Operations with createAsyncThunk
&lt;/h3&gt;

&lt;p&gt;Handling asynchronous actions can be challenging, but Redux Toolkit introduces createAsyncThunk to make it seamless. Fetching data from APIs becomes straightforward, enhancing the overall efficiency of asynchronous operations.&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="c1"&gt;// Importing createAsyncThunk from Redux Toolkit&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;createAsyncThunk&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;@reduxjs/toolkit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Async Operation&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fetchData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createAsyncThunk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;myFeature/fetchData&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &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="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.example.com/data&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="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Reducer Handling Async Operation&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mySlice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createSlice&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;myFeature&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="na"&gt;reducers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Other synchronous reducers&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;extraReducers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;builder&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;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fetchData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fulfilled&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="c1"&gt;// Handle the successful data fetch&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;h3&gt;
  
  
  Chapter 6: Embracing Immutability
&lt;/h3&gt;

&lt;p&gt;No discussion on state management is complete without emphasizing the importance of immutability. Redux Toolkit ensures our state remains unchanged by discouraging mutation, promoting the use of pure functions for a more stable and predictable application state.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In the past, using Redux alone could be a bit cumbersome due to a few challenges. First, configuring a Redux store often involved dealing with complex setups. Second, to make Redux really useful, we had to rely on multiple packages, which could lead to a bloated project. Lastly, writing Redux code often resulted in a lot of boilerplate, making the codebase harder to manage.&lt;br&gt;
However, with the introduction of Redux Toolkit, these problems have been efficiently addressed! ✅&lt;br&gt;
Redux Toolkit simplifies the process of creating and configuring a Redux store. It offers a streamlined API and a set of utilities that make setting up the store much more straightforward and less intimidating.&lt;br&gt;
Moreover, it provides a set of pre-configured packages and utilities, so you don't need to search for additional libraries to perform common tasks. This not only saves time but also ensures that your project remains lean and efficient.&lt;br&gt;
The best part is that Redux Toolkit encourages the use of modern Redux patterns like the "slice" approach. By using slices, you can write concise, organized, and maintainable code, significantly reducing the boilerplate traditionally associated with Redux.&lt;/p&gt;

&lt;p&gt;So, if you're working with Redux or planning to start a new project that involves Redux, I highly recommend giving Redux Toolkit a try! It's a powerful tool that makes managing state in Redux much more enjoyable and productive.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpolk5s8gmua5yvgflf9s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpolk5s8gmua5yvgflf9s.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>redux</category>
      <category>react</category>
    </item>
    <item>
      <title>Exploring the React Component Lifecycle</title>
      <dc:creator>SAIKAT BISHAL</dc:creator>
      <pubDate>Tue, 21 Feb 2023 07:56:14 +0000</pubDate>
      <link>https://dev.to/saikatbishal/exploring-the-react-component-lifecycle-35h3</link>
      <guid>https://dev.to/saikatbishal/exploring-the-react-component-lifecycle-35h3</guid>
      <description>&lt;h2&gt;
  
  
  A Journey Through the Life of a React Component.
&lt;/h2&gt;

&lt;p&gt;In React, everything is a component. From the simplest UI elements to the most complex application views, each one is built using React's component architecture. But how does a React component actually work behind the scenes? That's where the React component lifecycle comes in.&lt;/p&gt;

&lt;p&gt;The React component lifecycle is a series of phases that every React component goes through. Think of it as a journey through the life of a React component. Each phase has its own set of methods and behaviors, and understanding how they all fit together is crucial for building robust and performant React applications.&lt;/p&gt;

&lt;p&gt;To help you better understand the React component lifecycle, let's use an analogy. Think of a React component as a tree. Just like a tree, a React component has roots, branches, leaves, and a trunk. Each of these parts corresponds to a different phase of the React component lifecycle.&lt;/p&gt;

&lt;p&gt;The roots of the tree represent the first phase of the React component lifecycle: &lt;/p&gt;

&lt;h3&gt;
  
  
  Mounting
&lt;/h3&gt;

&lt;p&gt;This is where a new component is created and added to the React tree. Just like a tree's roots, a React component's mounting phase is all about establishing a strong foundation.&lt;/p&gt;

&lt;p&gt;Next up are the branches. These represent the second phase of the React component lifecycle:&lt;/p&gt;

&lt;h3&gt;
  
  
  Updating
&lt;/h3&gt;

&lt;p&gt;When a component is updated, it's like the tree's branches growing and changing shape. During this phase, the component can receive new props, update its internal state, and make decisions about how to render itself based on these changes.&lt;/p&gt;

&lt;p&gt;As the branches grow and change, they produce new leaves. In the React component lifecycle, the leaves correspond to the third phase: &lt;/p&gt;

&lt;h3&gt;
  
  
  Unmounting
&lt;/h3&gt;

&lt;p&gt;This is when a component is removed from the React tree and its resources are released. Just like a tree's leaves falling off in the autumn, a React component's unmounting phase is all about letting go and freeing up resources.&lt;/p&gt;

&lt;p&gt;Finally, we have the trunk. This represents the fourth and final phase of the React component lifecycle: &lt;/p&gt;

&lt;h3&gt;
  
  
  Error Handling
&lt;/h3&gt;

&lt;p&gt;If something goes wrong during the previous phases, like an error in the component's render method, the component will enter the error handling phase. This is like a tree's trunk, providing a strong support system for the rest of the tree.&lt;/p&gt;

&lt;p&gt;So there you have it, a fun and easy-to-understand analogy for exploring the React component lifecycle. Just like a tree, a React component goes through many changes and stages in its lifetime, and understanding each one is crucial for building successful React applications.&lt;/p&gt;

&lt;p&gt;Ok that ended quickly, so let's dive a bit deeper than this. Let's write some code. But don't worry, I'll try to make this easy - &lt;/p&gt;

&lt;h2&gt;
  
  
  Deep Dive
&lt;/h2&gt;

&lt;p&gt;The React component lifecycle is a series of phases that every React component goes through, from creation to destruction. Each phase has its own set of methods and behaviors that developers can use to customize and control how their components behave. Here are the four phases of the React component lifecycle, along with the most important methods associated with each one:&lt;/p&gt;

&lt;h3&gt;
  
  
  Mounting
&lt;/h3&gt;

&lt;p&gt;This is the first phase of the React component lifecycle, where a new component is created and added to the React tree. During this phase, the following methods are called in order:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;constructor()&lt;/strong&gt;: This method is called before the component is mounted, and is used to initialize the component's state and bind event handlers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;static getDerivedStateFromProps(props, state)&lt;/strong&gt;: This method is called before every render, and is used to update the component's state based on changes to its props.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;render()&lt;/strong&gt;: This method is called to create the component's virtual DOM representation, which is used to generate the actual HTML.&lt;/p&gt;

&lt;p&gt;componentDidMount(): This method is called after the component is mounted, and is used to perform any necessary setup, such as fetching data from a server or initializing third-party libraries.&lt;/p&gt;

&lt;p&gt;Here's an example of the mounting phase:&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="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&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="nf"&gt;constructor&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="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;super&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="k"&gt;this&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="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&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;handleClick&lt;/span&gt; &lt;span class="o"&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;handleClick&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&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="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="nf"&gt;getDerivedStateFromProps&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;state&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Update state based on props&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;count&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;count&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;handleClick&lt;/span&gt;&lt;span class="p"&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="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;count&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&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="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;Count&lt;/span&gt;&lt;span class="p"&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&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;handleClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Increment&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&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="nf"&gt;componentDidMount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Fetch data from a server&lt;/span&gt;
    &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.example.com/data&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="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&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;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;count&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;count&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;h3&gt;
  
  
  Updating
&lt;/h3&gt;

&lt;p&gt;This is the second phase of the React component lifecycle, where a component can be updated due to changes in its props or state. During this phase, the following methods are called in order:&lt;br&gt;
static getDerivedStateFromProps(props, state): This method is called before every render, and is used to update the component's state based on changes to its props.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;shouldComponentUpdate(nextProps, nextState)&lt;/strong&gt;: This method is called to determine whether the component should re-render or not. If it returns false, the component will not update.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;render()&lt;/strong&gt;: This method is called to create the component's virtual DOM representation, which is used to generate the actual HTML.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;getSnapshotBeforeUpdate(prevProps, prevState)&lt;/strong&gt;: This method is called before the component's virtual DOM is updated, and is used to capture any information about the current DOM state, such as scroll position.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;componentDidUpdate(prevProps, prevState, snapshot)&lt;/strong&gt;: This method is called after the component's virtual DOM is updated, and is used to perform any necessary cleanup or side effects, such as updating a third-party library.&lt;/p&gt;

&lt;p&gt;Here's an example of the updating phase:&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="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&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="nf"&gt;constructor&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="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;super&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="k"&gt;this&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="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&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;handleClick&lt;/span&gt; &lt;span class="o"&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;handleClick&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&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="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;shouldComponentUpdate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;nextProps&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;nextState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Only re-render if count has changed&lt;/span&gt;
    &lt;span class="k"&gt;return&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nx"&gt;nextState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;handleClick&lt;/span&gt;&lt;span class="p"&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="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;count&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&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="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;Count&lt;/span&gt;&lt;span class="p"&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;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&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;handleClick&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Increment&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&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="nf"&gt;componentDidMount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Perform any necessary setup&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;componentDidUpdate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prevProps&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;prevState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="c1"&gt;// Check if props or state have changed&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prevProps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&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;count&lt;/span&gt;&lt;span class="p"&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="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;count&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;count&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="nf"&gt;componentWillUnmount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Perform any necessary cleanup&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Component is unmounted&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Unmounting
&lt;/h3&gt;

&lt;p&gt;In the unmounting phase of a component's lifecycle, the component is removed from the DOM and any cleanup operations necessary are performed. This typically involves removing any event listeners, cancelling any network requests or timers, and generally releasing any resources held by the component.&lt;/p&gt;

&lt;p&gt;Here's an example of a component that sets up an event listener in the &lt;code&gt;componentDidMount&lt;/code&gt; method and removes it in the &lt;code&gt;componentWillUnmount&lt;/code&gt; method:&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="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&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="nf"&gt;constructor&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="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;super&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handleClick&lt;/span&gt; &lt;span class="o"&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;handleClick&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&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="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;handleClick&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Button clicked&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="nf"&gt;componentDidMount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Add event listener when component is mounted&lt;/span&gt;
    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&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;handleClick&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;componentWillUnmount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Remove event listener when component is unmounted&lt;/span&gt;
    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&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;handleClick&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&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="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Click&lt;/span&gt; &lt;span class="nx"&gt;me&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the &lt;code&gt;MyComponent&lt;/code&gt; class defines a handleClick method that logs a message to the console, and adds an event listener to the document element in the &lt;code&gt;componentDidMount&lt;/code&gt; method. This event listener listens for the click event and calls the handleClick method.&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;componentWillUnmount&lt;/code&gt; method, the event listener is removed from the document element to prevent memory leaks and other issues when the component is removed from the DOM.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, understanding the React component lifecycle is essential for creating robust and efficient applications with React. By leveraging the different lifecycle methods such as &lt;code&gt;componentDidMount&lt;/code&gt;, &lt;code&gt;componentDidUpdate&lt;/code&gt;, and &lt;code&gt;componentWillUnmount&lt;/code&gt;, developers can create components that effectively handle state updates, respond to user input, and cleanly release resources when they are no longer needed.&lt;/p&gt;

&lt;p&gt;In addition, the recent introduction of new lifecycle methods such as &lt;code&gt;getDerivedStateFromProps&lt;/code&gt; and &lt;code&gt;getSnapshotBeforeUpdate&lt;/code&gt; provides even more flexibility in how components can be designed and optimized.&lt;/p&gt;

&lt;p&gt;By carefully considering the different lifecycle methods available and their uses, developers can create more maintainable, scalable, and efficient React applications. It's important to note that the React team has deprecated some lifecycle methods such as &lt;code&gt;componentWillReceiveProps&lt;/code&gt; and &lt;code&gt;componentWillUpdate&lt;/code&gt; in favor of the newer methods, so staying up to date with the latest changes and best practices is crucial for creating high-quality React applications.&lt;/p&gt;

</description>
      <category>mentalhealth</category>
      <category>discuss</category>
      <category>inclusion</category>
    </item>
    <item>
      <title>Beginners guide to using git like a pro.</title>
      <dc:creator>SAIKAT BISHAL</dc:creator>
      <pubDate>Sun, 21 Aug 2022 19:41:20 +0000</pubDate>
      <link>https://dev.to/saikatbishal/beginners-guide-to-using-git-like-a-pro-5dpb</link>
      <guid>https://dev.to/saikatbishal/beginners-guide-to-using-git-like-a-pro-5dpb</guid>
      <description>&lt;h2&gt;
  
  
  What is git?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Git&lt;/strong&gt; is a free and open-source software for distributed version control. It differs from GitHub, one of the many websites that used git as its version control software. What is Distributed Version Control, you ask. &lt;strong&gt;distributed version control&lt;/strong&gt; (also known as &lt;strong&gt;distributed revision control&lt;/strong&gt;) is a form of version control&lt;br&gt;
 in which the complete codebase, including its full history, is mirrored on every developer's computer.&lt;/p&gt;

&lt;p&gt;For better understanding, let me explain you a situation I faced very early in my career and how git saved me from it. &lt;/p&gt;

&lt;p&gt;When I first learned about git, I started using it everywhere. (You do not need internet to use git. You just need git installed in your system to track changes). I was writing my college essay for my final project which was due very soon. So after pulling an all-nighter, I went to take a quick nap. Sometime between that time, my roommate mischievously changed the whole essay to lorem ipsum and saved it. &lt;/p&gt;

&lt;p&gt;But unknown to him, I had committed it to git before going to bed and had also created a backup branch. What a loser. I just had to go back to my last commit and pull it back from where I had left. You should have seen his face the next day when I nonchalantly submitted the project.&lt;/p&gt;

&lt;p&gt;I will tell you exactly how I did it. It is easy and fun.&lt;/p&gt;
&lt;h3&gt;
  
  
  Initialize your Folder (also called Repository)
&lt;/h3&gt;

&lt;p&gt;Go into the folder, the changes to which you want to track. i.e., You will be asking git to watch that folder (lets call it proGit) for any change that occurs hereafter. Open the command prompt (or any other CLI) inside proGit and type in this .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;git init - initialize a folder to track the changes made to it using git source control.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Make changes to the folder as you wish. You could add, delete, replace the whole code or even rename the files. &lt;/p&gt;

&lt;h2&gt;
  
  
  git add
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;git add&lt;/code&gt;command adds new or changed files in your working directory to the Git staging area.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt; // this means git add all
git add &amp;lt;path&amp;gt;/&amp;lt;filename&amp;gt; 
// this means that you add only the files you want to commit.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the most important step. Without it, the next step is utterly useless. As you're working, you change and save a file, or multiple files. Then, before you commit, you must &lt;code&gt;git add&lt;/code&gt;. This step allows you to choose what you are going to commit. This way you make it harder for anyone(including yourself) to make a big blunder.&lt;/p&gt;

&lt;h2&gt;
  
  
  git commit
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git commit&lt;/code&gt;creates a commit, which is like a snapshot of your repository. These commits are snapshots of your entire repository at specific times. This is the main reason why I was able to recover my progress from my last night project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"this is the comment header message"&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"this is the comment body message"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;-m after the commit command means commit message.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Note : Always remember to add easily understandable comment messages. Over time, commits should tell a story of the history of your project.&lt;/p&gt;

&lt;p&gt;So now that you’ve made the changes and saved the history to git. You can now rest easy that your progress isn’t going anywhere. &lt;/p&gt;

&lt;p&gt;You wake up the next day and open your project. But now you do not like what you did last night. For some reason you need to uncommit and go back to your previous iteration. Time to revert the changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  git revert
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git revert&lt;/code&gt;is the safest way to change history with Git. Instead of deleting existing commits, &lt;code&gt;git revert&lt;/code&gt; looks at the changes introduced in a specific commit, then applies the inverse of those changes in a new commit. It is as if you have two duplicate commits at different times. It would look something like this&lt;/p&gt;

&lt;p&gt;a → b → c → b&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmp4w1ab5xk4y1lmfbq1a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmp4w1ab5xk4y1lmfbq1a.png" alt="Git Revert" width="409" height="135"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git revert HEAD &lt;span class="nt"&gt;--no-edit&lt;/span&gt;
// adding the option &lt;span class="nt"&gt;--no-edit&lt;/span&gt; to skip the commit message editor
git revert HEAD~x 
// x is a number. &lt;span class="nv"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 going back one more, &lt;span class="nv"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2 going back two more, etc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  git reset
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git reset&lt;/code&gt; brings the repository back to an earlier state in the commits without making a new &lt;code&gt;commit&lt;/code&gt;. I would not recommend this unless there is some very good reason to totally prune the commits (like hiding sensitive data or api private keys, etc.) Resetting is a one way time travel where you can’t travel back to the future.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6cm1nsbxdlssitvg244h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6cm1nsbxdlssitvg244h.png" alt="Before" width="490" height="177"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdutaztl0s1nw8d98c8q7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdutaztl0s1nw8d98c8q7.png" alt="After" width="382" height="223"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After&lt;/p&gt;

&lt;p&gt;You can learn more about  &lt;code&gt;git reset&lt;/code&gt;  in this &lt;a href="https://www.atlassian.com/git/tutorials/undoing-changes/git-reset" rel="noopener noreferrer"&gt;blog&lt;/a&gt; by Atlassian.&lt;/p&gt;

&lt;p&gt;So far so good. But now you want to try out some new changes to your project that you aren’t confident would work. So if that doesn’t work well, you will have to undo them later and move back to where you are now. You also don’t want to go through the hassle of reset or revert. Or say you want to create a different version of your project. This creates a perfect example where &lt;code&gt;git branch&lt;/code&gt; can be used.&lt;/p&gt;

&lt;h2&gt;
  
  
  git branch
&lt;/h2&gt;

&lt;p&gt;A&lt;code&gt;branch&lt;/code&gt; is a new/separate version of the main repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch 
// this shows the name of all the branches you have on your folder

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &amp;lt;new-branch&amp;gt; 
//  this creates a new branch  with the name of the new-branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fojx12zsxqe6jziigy4ud.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fojx12zsxqe6jziigy4ud.png" alt="Branching from the parent branch(in blue).  Green and purple circles signify the commits done in the new branches (also called the feature branches)." width="568" height="199"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Branching from the parent branch(in blue).  Green and purple circles signify the commits done in the new branches (also called the feature branches).&lt;/p&gt;

&lt;p&gt;The above image visually shows you how your folder would be structured inside git. A folder can have as many branches as is required but I would suggest that you have as less as possible and they be as descriptive as possible in their names.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-d&lt;/span&gt; &amp;lt;branch&amp;gt;
// This &lt;span class="nb"&gt;command &lt;/span&gt;deletes a redundant or useless branch.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Always delete the branches that you are sure will not be used or has been merged to the main branch (to avoid confusion).  Never use uppercase -D unless you are double sure. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;git branch -D &amp;lt;branch&amp;gt;&lt;/code&gt; force deletes the branch, even if there are unmerged changes.&lt;/p&gt;

&lt;p&gt;git checkout : You can hop around from branch to branch using this command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout &amp;lt;new-branch&amp;gt; 
// you are currently &lt;span class="k"&gt;in &lt;/span&gt;the new-branch. all changes that you make hereafter will be effected &lt;span class="k"&gt;in &lt;/span&gt;the new-branch.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout main
// You have now hopped to the main branch.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that you are pretty sure that your feature branch looks better than your main project, you would certainly want to add this to your main branch. &lt;/p&gt;

&lt;h2&gt;
  
  
  git merge
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Git merge&lt;/code&gt;will combine multiple sequences of commits into one unified history. In the most frequent use cases, It is used to combine two branches.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqa684qnuxpmgqqbm70bi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqa684qnuxpmgqqbm70bi.png" alt="Merging the featire branch to the main branch" width="800" height="439"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout &amp;lt;old-branch&amp;gt;
// Place yourself on the branch which would act as the base branch. i.e., the new branch would merge into this branch.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git merge &amp;lt;new-branch&amp;gt; 
// Merge the new branch to the base branch.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-d&lt;/span&gt; &amp;lt;new-branch&amp;gt;
// Now delete the new-branch. This is already merged, hence redundant.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is how you can start to use git in your personal projects and reap the benefits of this cool version control system. But there are a lot more features and sub features of all these commands. There are commands which are particularly useful when you are working in a team and storing project data in a remote repository like GitHub or Bitbucket. &lt;/p&gt;

&lt;p&gt;I’ll be talking about some of them in my next blog. Let me know in the comments if there is something I missed or some confusion regarding the blog. Feel free to leave a heard if it helped you in any way.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>CSS color tricks to make your life easier</title>
      <dc:creator>SAIKAT BISHAL</dc:creator>
      <pubDate>Wed, 17 Aug 2022 18:57:17 +0000</pubDate>
      <link>https://dev.to/saikatbishal/css-color-tricks-to-make-your-life-easier-40i8</link>
      <guid>https://dev.to/saikatbishal/css-color-tricks-to-make-your-life-easier-40i8</guid>
      <description>&lt;p&gt;Colors in CSS are pretty easy to handle and do not pose much difficulty. But there are certain tricks not many developers know, that could make your life much easier while working with CSS colors.&lt;/p&gt;

&lt;p&gt;Read on to learn about them.&lt;/p&gt;

&lt;h2&gt;
  
  
  You do not need comma separated values
&lt;/h2&gt;

&lt;p&gt;Very recently the syntax of CSS has been updated for rgb and hsl because we have many new syntaxes(functions) coming in the near future. We can work with bigger color gamuts. &lt;/p&gt;

&lt;p&gt;Now we do not have to add commas when specifying rgba values.&lt;br&gt;
Example :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.color-old-syntax {
background-color : rgb(100,255,120);

}

.color-new-syntax {
background-color : rgb(100 255 120);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  You do not need an &lt;em&gt;a&lt;/em&gt; in to specify opacity
&lt;/h2&gt;

&lt;p&gt;While we needed to specify &lt;em&gt;rgba&lt;/em&gt; or &lt;em&gt;hsla&lt;/em&gt; so that we could add an opacity value to the element, we do not need it in the new syntax. &lt;br&gt;
Example :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.color-old-syntax {
background-color : hsla(100,50,50,0.5)
}
.color-new-syntax {
background-color : hsl(100 50 50 / 0.5)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that you still would be able to specify the opacity in the same function. The syntax has changed from comma separated values to a forward slash (just to specify the opacity value).&lt;/p&gt;

&lt;h2&gt;
  
  
  Specify values with percentages in rgb
&lt;/h2&gt;

&lt;p&gt;You can now specify the color values in percentages rather than specifying them on a 0 to 255 scale.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.color-old-syntax {
background-color : rgb(127,100,100,0.5)
}
.color-new-syntax {
background-color : rgb(50%,40%,40%,0.5)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a better way to visualise how the colors would behave when mixed up in certain percentages or to compare two rgb colors.&lt;br&gt;
Needless to say, you do not have to use this if you do not want to. Everything is backward compatible.&lt;/p&gt;

&lt;p&gt;What's more, you could also mix and match percentage and absolute values inside the rgb() function. But I would not recommend that.&lt;br&gt;
Example :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
.rgb-background-new {
background-color : rgb(100% 255 50%)
}

//is same as

.rgb-background-old {
background-color : rgb(255 255 127)

}

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;This mix and match feature is just in chrome right now.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  hsl() is more intuitive than rgb()
&lt;/h2&gt;

&lt;p&gt;hsl stands for &lt;em&gt;hue saturation lightness&lt;/em&gt;&lt;br&gt;
 Hue is the actual color you want to get. It is in the range of 0 to 360 degree where 0 and 360 is pure red. (&lt;em&gt;see the hsl color wheel&lt;/em&gt; for more info).&lt;br&gt;
Saturation is the &lt;strong&gt;amount of color&lt;/strong&gt; that you want of a certain hue. This is specified in percentages.&lt;/p&gt;

&lt;p&gt;The lightness of a color can be described as ** how much light** you want to give the color. It is also in percentage where 0% is black and 100% is white. 50% is the sweet spot if you want to get the most pure color.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7fdxx1sfbpopkgaf4e3t.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7fdxx1sfbpopkgaf4e3t.jpg" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.hsl-map-one {
background-color: hsl(0 50% 50%);
}
// is same as
.hsl-map-two {
background-color : hsl(360 50% 50%); 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;red -- 0&lt;br&gt;
green -- 120&lt;br&gt;
blue -- 240&lt;br&gt;
hsl in this way is more intuitive if you need to specify colors in between the three primary color (for example anything that is a mix of red and green would be between 0 and 120), you just need to change the first value of the function for that unlike rgb().&lt;/p&gt;
&lt;h2&gt;
  
  
  Hue values in hsl() can go beyond 0 degree and 360 degree
&lt;/h2&gt;

&lt;p&gt;As we know hsl() hue works on the concept of color wheel, it makes sense that the hue value can go beyond 360. &lt;br&gt;
Example :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.hue-value-one {
background-color : hsl(120 50% 50%)
}

// is same as  

.hue-value-one {
background-color : hsl(480 50% 50%)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The hue value can also go negative. (You can visualise this as the values go from 0 to negative, the arrow rotates in counterclock wise direction). Hence hsl(120 50% 50%) is same as hsl(-240 50 50).&lt;/p&gt;

&lt;p&gt;These properties are particularly useful when you use javascript to dynamically change the color values. You do not have to use a lot of calculation on javaScript to make this work. Quite handy isn't it?&lt;/p&gt;

&lt;h2&gt;
  
  
  Opacity can now work in percentages
&lt;/h2&gt;

&lt;p&gt;Not that it would make much difference, yet it is better to know that we can now specify the opacity values in decimal as well as in percentages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.opacity-box-one {
background-color : rgb (100  200 100 / 0.5);
}

// is same as

.opacity-box-two {
background-color : rgb (100 200 100 / 50%);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is it. If you know any other tricks or newer css features , feel free to comment that below. It would be very helpful for all the readers and me as well. &lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>design</category>
    </item>
    <item>
      <title>How to make a Splash Screen using HTML CSS and JavaScript</title>
      <dc:creator>SAIKAT BISHAL</dc:creator>
      <pubDate>Wed, 13 Jul 2022 16:08:35 +0000</pubDate>
      <link>https://dev.to/saikatbishal/how-to-make-a-splash-screen-using-html-css-and-javascript-240m</link>
      <guid>https://dev.to/saikatbishal/how-to-make-a-splash-screen-using-html-css-and-javascript-240m</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/saikatbishal/embed/RwMReEr?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Does your college project have a splash screen that welcomes viewers to your humble website?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://codepen.io/saikatbishal/pen/RwMReEr" rel="noopener noreferrer"&gt;Here&lt;/a&gt; is how I made a splash screen using just HTML, CSS and JavaScript. You can copy paste the code in your single page project and change the HTML as you wish. But if you wish to go in depth of how it was made, then read on.&lt;/p&gt;

&lt;h3&gt;
  
  
  The idea is to overlay a div over the main page and turn its opacity to 0 when it is clicked.
&lt;/h3&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%2Fuploads%2Farticles%2Fsb6avashi8pyhecr2nr9.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%2Fuploads%2Farticles%2Fsb6avashi8pyhecr2nr9.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The HTML
&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%2Fuploads%2Farticles%2F90p3bb0hcb1402f7pc0m.png" 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%2Fuploads%2Farticles%2F90p3bb0hcb1402f7pc0m.png" alt="The HTML"&gt;&lt;/a&gt;&lt;br&gt;
The HTML is quite simple. Just make a container &lt;code&gt;div&lt;/code&gt; that we would, at a later stage, style using css. From now on we will call it &lt;code&gt;splash container&lt;/code&gt;. This &lt;code&gt;div&lt;/code&gt; would block the main page view when the site fires up.&lt;br&gt;
Inside the &lt;code&gt;splash container&lt;/code&gt; div put the contents of your splash screen. It could be anything that you want to show or tell the user at the start.&lt;/p&gt;

&lt;h2&gt;
  
  
  The CSS
&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%2Fuploads%2Farticles%2F7gqp3119crslraak04yx.png" 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%2Fuploads%2Farticles%2F7gqp3119crslraak04yx.png" alt="The CSS"&gt;&lt;/a&gt;&lt;br&gt;
In CSS our main focus would be to make the splash container cover the whole screen. Choose the &lt;code&gt;background-color&lt;/code&gt; &lt;code&gt;height&lt;/code&gt; and &lt;code&gt;width&lt;/code&gt; of your screen as you would like. &lt;br&gt;
For centering the splash container, we used fixed positioning and a top and left of 50%. But this just centers the top left corner of the splash-screen.&lt;/p&gt;

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

position : fixed;
top : 50%;
left : 50%;


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

&lt;/div&gt;

&lt;p&gt;To center the splash container around itself, we need to put a transform and move it by -50% on both axes.&lt;/p&gt;

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

transform : translate(-50%,-50%);


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

&lt;/div&gt;

&lt;p&gt;To make it look cooler when it dissapears we would also add a transition. I generally use ease-in-out in almost all my projects. Additionaly, it would take 600ms for my splash screen to fully dissapear when it is clicked.But feel free to change it according to your wish.&lt;/p&gt;

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

transition : all ease-in-out 600ms;


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

&lt;/div&gt;

&lt;p&gt;Now, just to add a bit more detailing, We will add a cursor style on the splash screen.&lt;br&gt;
(But this might make us write some extra code in CSS and JS 🥲). &lt;/p&gt;

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

cursor : pointer;


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

&lt;/div&gt;

&lt;p&gt;Get the full list of cursor-types &lt;a href="https://www.w3schools.com/csSref/pr_class_cursor.asp" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We add a class which hides the container (after the opacity is turned to 0 using JS) so that the pointer doesn't show for the next eternity even though the splash screen isn't visible to the user.&lt;/p&gt;

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

.hidden{
  transition : 0.5s;
  display : none;
}


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

&lt;/div&gt;

&lt;p&gt;This hidden class would be added dynamically using JS.&lt;/p&gt;

&lt;h2&gt;
  
  
  The JS
&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%2Fuploads%2Farticles%2F35ji1qj5lusuv7nc3qj2.png" 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%2Fuploads%2Farticles%2F35ji1qj5lusuv7nc3qj2.png" alt="The JS"&gt;&lt;/a&gt;&lt;/p&gt;

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

var splashScreen = document.querySelector('.splash');


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

&lt;/div&gt;

&lt;p&gt;To manipulate the &lt;code&gt;splash container&lt;/code&gt; we first  have to capture the element with the class &lt;code&gt;splash&lt;/code&gt;. For this we use &lt;code&gt;querySelector()&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;We add an event Listener which listens for a &lt;code&gt;click&lt;/code&gt; on the &lt;code&gt;splash-container&lt;/code&gt;. (In simple language we are telling js to listen for a click of the mouse on the said container).&lt;/p&gt;

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

splashScreen.addEventListener('click',someFunction())


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

&lt;/div&gt;

&lt;p&gt;As soon as the click happens, a function is triggered. Lets call this function &lt;code&gt;parentFunction&lt;/code&gt;. What does &lt;code&gt;parentFunction&lt;/code&gt; function do?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It adds a style property to the 'splash container' that turn its opacity to 0.
```
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;splashScreen.style.opacity = 0;&lt;br&gt;
  // CSS style -- opacity : 0;&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2. It also adds a `hidden` class to our `splash container` class after 600ms. (This is so that we do not see the pointer cursor on the screen). 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;setTimeout(()=&amp;gt;{&lt;br&gt;
    splashScreen.classList.add('hidden')&lt;br&gt;
  },610)&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
`setTimeout()` is a custom function that takes in two parameters.
 The **first parameter** is some action that has to be done. (A function that adds a class to a div in this case).
The **second parameter** is the time after which the action is to be done (in milliseconds).

That's it. You are ready to make and customize your own splash screen. Have fun with my code on codepen and feel free to check out my other pens there. Please put a heart if this helped you in any way.

Thanks for reading. ❤️

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

&lt;/div&gt;

</description>
      <category>codepen</category>
      <category>html</category>
      <category>css</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
