<?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: Sarthak Pant</title>
    <description>The latest articles on DEV Community by Sarthak Pant (@sarthakpant772).</description>
    <link>https://dev.to/sarthakpant772</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%2F726171%2Fc259e9f8-8d0d-47dc-b1be-b87dcacb2691.png</url>
      <title>DEV Community: Sarthak Pant</title>
      <link>https://dev.to/sarthakpant772</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sarthakpant772"/>
    <language>en</language>
    <item>
      <title>From Talking Head to Visual Storytelling: Why Static Videos Are Losing Viewers</title>
      <dc:creator>Sarthak Pant</dc:creator>
      <pubDate>Fri, 13 Mar 2026 21:30:02 +0000</pubDate>
      <link>https://dev.to/sarthakpant772/from-talking-head-to-visual-storytelling-why-static-videos-are-losing-viewers-569g</link>
      <guid>https://dev.to/sarthakpant772/from-talking-head-to-visual-storytelling-why-static-videos-are-losing-viewers-569g</guid>
      <description>&lt;p&gt;You've spent hours crafting the perfect explanation. The lighting is right, the script is tight, and your delivery is on point. You hit publish — and the retention graph drops off a cliff at the 30-second mark.&lt;/p&gt;

&lt;p&gt;Sound familiar? You're not alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Talking-Head Problem
&lt;/h2&gt;

&lt;p&gt;Talking-head videos dominate YouTube, LinkedIn, and course platforms. They're the fastest format to produce: set up a camera, hit record, talk. But there's a growing gap between what creators produce and what audiences actually watch.&lt;/p&gt;

&lt;p&gt;According to Wistia's video engagement data, videos that mix visuals with narration retain &lt;strong&gt;35% more viewers&lt;/strong&gt; past the halfway mark compared to static talking-head footage. The reason is simple: our brains process visual information 60,000 times faster than text. When someone explains a concept verbally while the screen shows... just their face, viewers' attention drifts.&lt;/p&gt;

&lt;p&gt;Think about the best educational content you've watched recently. Chances are it wasn't just someone talking — it had diagrams appearing on cue, charts reinforcing data points, or text highlighting key phrases.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Visual Storytelling Actually Means
&lt;/h2&gt;

&lt;p&gt;Visual storytelling in video isn't about flashy transitions or stock footage B-roll. It's about &lt;strong&gt;matching what the viewer sees to what the viewer hears&lt;/strong&gt; at any given moment.&lt;/p&gt;

&lt;p&gt;When you say "revenue grew 3x," a chart should appear. When you explain a three-step process, a flowchart should build alongside your narration. When you mention a key term, it should appear on screen.&lt;/p&gt;

&lt;p&gt;This is what professional productions do. The problem? It traditionally requires:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A video editor who understands motion graphics&lt;/li&gt;
&lt;li&gt;Software like After Effects or Premiere Pro&lt;/li&gt;
&lt;li&gt;Hours of manual keyframing per minute of content&lt;/li&gt;
&lt;li&gt;A budget that most solo creators don't have&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  AI Is Closing the Gap
&lt;/h2&gt;

&lt;p&gt;The most interesting shift in video editing right now is AI that understands context — not just cuts and transitions, but the &lt;em&gt;meaning&lt;/em&gt; of what's being said.&lt;/p&gt;

&lt;p&gt;Tools like &lt;a href="https://viona.app" rel="noopener noreferrer"&gt;Viona&lt;/a&gt; are approaching this differently. Instead of asking creators to manually build graphics, the AI listens to your narration, identifies moments that benefit from visual support, and generates contextual illustrations — charts, diagrams, flowcharts — synced to your words automatically.&lt;/p&gt;

&lt;p&gt;The workflow becomes: record your talking head, upload it, and get back a visually-rich video without touching a timeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical Tips for Better Visual Videos
&lt;/h2&gt;

&lt;p&gt;Even without AI tools, you can start improving your talking-head content today:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Identify Your "Visual Moments"
&lt;/h3&gt;

&lt;p&gt;Review your script and highlight every statistic, list, comparison, or process. These are your visual moments — points where a graphic would reinforce comprehension.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Use the Rule of Three
&lt;/h3&gt;

&lt;p&gt;If you reference three or more items in sequence, they should appear on screen. Audiences can't hold more than 3-4 items in working memory from audio alone.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Emphasize with Text
&lt;/h3&gt;

&lt;p&gt;Key phrases and quotes from your narration should appear as text overlays. This isn't just for accessibility — it reinforces retention for all viewers.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Don't Over-Illustrate
&lt;/h3&gt;

&lt;p&gt;Not every sentence needs a graphic. Visual fatigue is real. The best educational videos alternate between face-time (for connection) and visuals (for comprehension).&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Captions Are Non-Negotiable
&lt;/h3&gt;

&lt;p&gt;85% of Facebook videos are watched without sound. On every platform, captions dramatically increase watch time. Style them well — they're part of your visual identity.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Creator's Advantage
&lt;/h2&gt;

&lt;p&gt;Here's what's changing: the barrier between "talking-head creator" and "visual content producer" is disappearing. You don't need a production team. You don't need to learn After Effects.&lt;/p&gt;

&lt;p&gt;If you're producing educational content, tutorials, course material, or thought-leadership videos, the ROI on adding visuals is massive. Higher retention means more watch time, which means better algorithmic reach, which means more growth.&lt;/p&gt;

&lt;p&gt;Tools like &lt;a href="https://viona.app" rel="noopener noreferrer"&gt;Viona&lt;/a&gt; exist specifically for this use case — transforming talking-head footage into visually-rich content with AI-generated graphics and styled captions. But regardless of which tool you use, the shift toward visual storytelling is one creators can't afford to ignore.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;What's your experience with visual content? Have you noticed a difference in engagement between talking-head and illustrated videos? I'd love to hear your take in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>design</category>
      <category>learning</category>
      <category>marketing</category>
    </item>
    <item>
      <title>Unveiling the Power of Virtual DOM for Efficient UI Rendering</title>
      <dc:creator>Sarthak Pant</dc:creator>
      <pubDate>Mon, 25 Dec 2023 14:07:13 +0000</pubDate>
      <link>https://dev.to/sarthakpant772/unveiling-the-power-of-virtual-dom-for-efficient-ui-rendering-2pka</link>
      <guid>https://dev.to/sarthakpant772/unveiling-the-power-of-virtual-dom-for-efficient-ui-rendering-2pka</guid>
      <description>&lt;p&gt;React's Virtual DOM is a key concept that contributes to the efficiency and performance of React applications. It's an abstraction of the actual DOM (Document Object Model) and serves as an intermediary layer between the application's logic and the browser's rendering engine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OKt86VuR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://s3.ap-southeast-1.amazonaws.com/arrowhitech.com/wp-content/uploads/2020/07/02034639/compare-768x319.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OKt86VuR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://s3.ap-southeast-1.amazonaws.com/arrowhitech.com/wp-content/uploads/2020/07/02034639/compare-768x319.jpg" alt="Virual Dom" width="768" height="319"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here's an overview of how the React Virtual DOM works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Real Dom vs Virtual Dom:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Real DOM&lt;/strong&gt;: The actual DOM is a tree-like structure that represents the structure of HTML elements in a document.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Virtual DOM:&lt;/strong&gt; React creates a lightweight copy of the real DOM known as the Virtual DOM. It's a JavaScript representation of the actual DOM.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Component Rendering:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When a React component renders, it doesn't directly update the real DOM.&lt;/li&gt;
&lt;li&gt;Instead, React generates a virtual representation of the UI using JSX (JavaScript XML) syntax.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Virtual DOM Reconciliation:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After each render, React compares the new virtual DOM with the previous one, using a process called "reconciliation."&lt;/li&gt;
&lt;li&gt;React determines the minimal number of steps needed to update the real DOM to match the new virtual DOM.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Diffing Algorithm:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React employs a reconciliation algorithm to efficiently update the real DOM. This process involves comparing the new and previous virtual DOM trees.&lt;/li&gt;
&lt;li&gt;React's "diffing" algorithm optimizes this comparison by minimizing the number of updates required.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Diffing Steps:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React compares the old and new virtual DOM trees, looking for differences at the top level.&lt;/li&gt;
&lt;li&gt;It identifies changes, additions, or removals of components and their respective properties.&lt;/li&gt;
&lt;li&gt;The algorithm efficiently narrows down the differences to the minimal set of operations required.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Reconciliation Process:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once the differences are identified, React constructs a "diff" or "change" set.&lt;/li&gt;
&lt;li&gt;This set contains the specific changes needed to update the real DOM.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Updating the Real DOM:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React applies the changes from the diff set to the real DOM in a process known as "reconciliation."&lt;/li&gt;
&lt;li&gt;This process is much more efficient than directly manipulating the entire real DOM.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Batched Updates:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React often performs updates asynchronously and batches multiple updates into a single operation.&lt;/li&gt;
&lt;li&gt;This helps in avoiding unnecessary reflows and repaints, improving overall performance.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Performance Benefits:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Virtual DOM allows React to minimize the impact on the actual DOM, resulting in improved performance and responsiveness.&lt;/li&gt;
&lt;li&gt;By selectively updating only the necessary parts of the DOM, React reduces the computational cost of rendering.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In summary, the React Virtual DOM is a crucial optimization technique that enhances the performance of React applications by efficiently updating the real DOM. It minimizes the number of operations required to reflect changes in the UI, resulting in a smoother and more responsive user experience.&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Intro to Redux-Toolkit</title>
      <dc:creator>Sarthak Pant</dc:creator>
      <pubDate>Mon, 26 Dec 2022 11:26:14 +0000</pubDate>
      <link>https://dev.to/sarthakpant772/intro-to-redux-toolkit-3f48</link>
      <guid>https://dev.to/sarthakpant772/intro-to-redux-toolkit-3f48</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;First, let's start with what is &lt;strong&gt;Redux&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Redux
&lt;/h3&gt;

&lt;p&gt;Redux is a state management library. Redux make it easy to debug and is used when we need consistency.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why we need Redux Toolkit then?
&lt;/h3&gt;

&lt;p&gt;Redux Toolkit does the same thing as redux do, that is to make our life more easier and simpler.&lt;br&gt;
Redux toolkit  includes utilities that helps to simplify many common use cases, including store setup, creating reducers and writing immutable update logic, and even creating entire "slices" of state at once. All of these term would be explained below.&lt;/p&gt;

&lt;p&gt;Let me explain the use of redux toolkit with a simple example.&lt;/p&gt;
&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;Lets say you are making an eCommerce website using react.Now u know that in react we use components.Lets say that you have made a website as shown below. 👇&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2F9gmhrui68t9btf8okfk1.png" class="article-body-image-wrapper"&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%2Farticles%2F9gmhrui68t9btf8okfk1.png" alt="Image description" width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now the nav bar is in different component and your product list is in different component.Lets say that you have added a product to the cart.So how do u think that other component knows what thing have changed in other component.Such changes are solved by the use of any state management libraries.Here we are using Redux Toolkit.&lt;br&gt;
So lets get started. ✨&lt;/p&gt;
&lt;h1&gt;
  
  
  Basic Terminologies
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;redux store:&lt;/em&gt;&lt;/strong&gt; A store is a state container which holds the application's state&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;redux slice:&lt;/em&gt;&lt;/strong&gt; A slice is the portion of Redux code that relates to a specific set of data and actions within the store 's state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;createAsyncThunk:&lt;/em&gt;&lt;/strong&gt; Handles all async function that we will create.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;createReducer():&lt;/em&gt;&lt;/strong&gt;A utility that simplifies creating Redux reducer functions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  Let's redux
&lt;/h1&gt;
&lt;h2&gt;
  
  
  Create a react app
&lt;/h2&gt;


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

npx create-react-app learnredux
cd learnredux

#yarn
yarn add create-react-app learnredux
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Install redux-toolkit
&lt;/h2&gt;


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

npm install react-redux
npm install @reduxjs/toolkit

#yarn

yarn add react-redux
yarn add @reduxjs/toolkit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Start by making app folder which will have store
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now make a &lt;code&gt;store.js&lt;/code&gt; in this we will be having all our reducers.&lt;/p&gt;

&lt;p&gt;Initialize it with this(&lt;code&gt;./src/app/store.js&lt;/code&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { configureStore, createReducer } from '@reduxjs/toolkit'
export const store = configureStore({
  reducer: {
  },
})

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Make a new folder named features in which we would have all our slices.(&lt;code&gt;./src&lt;/code&gt;)
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;p&gt;Let's make our first slice. Get inside features folder and then make a new folder named counter.(&lt;code&gt;./src/features&lt;/code&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir counter
cd counter
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make counterSlice.js inside counter folder (&lt;code&gt;./src/features/counter&lt;/code&gt;).&lt;br&gt;
inside this slice add this piece of code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createSlice } from '@reduxjs/toolkit'

const initialState = {
  count: 0,
}

export const counterSlice = createSlice({
  name: 'counter',
  initialState,
  reducers: {
    increment: (state) =&amp;gt; {
      state.count += 1
    },
    decrement: (state) =&amp;gt; {
      state.count -= 1
    },
    reset: (state) =&amp;gt; {
      state.count = 0
    },
    incrementByAmmount: (state, action) =&amp;gt; {
      state.count += action.payload
    },
  },
})

export const {
  increment,
  decrement,
  reset,
  incrementByAmmount,
} = counterSlice.actions

export default counterSlice.reducer

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

&lt;/div&gt;



&lt;p&gt;So if u see this code we are first making our initial state. You can think of this like whenever we reload, the current state will change to its initial State.&lt;br&gt;
Then you can see CounterSlice in this first we will declare a &lt;code&gt;name of this&lt;/code&gt; slice then the &lt;code&gt;start state (initial state)&lt;/code&gt;, then we have to make our reducers.&lt;code&gt;Reducer:&lt;/code&gt; (change the state of your slice).At the end we are exporting them out.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Now go to (&lt;code&gt;./src/app/store&lt;/code&gt;) and add this.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { configureStore } from '@reduxjs/toolkit'
import counterReducer from '../features/counter/counterSlice'
export const store = configureStore({
  reducer: { counter: counterReducer },
})

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

&lt;/div&gt;


&lt;p&gt;Even after adding the reducer, reducer cannot be used. &lt;br&gt;
For that we need to declare it inside &lt;code&gt;Provider&lt;/code&gt;.This is what we are going to do next.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;code&gt;index.js&lt;/code&gt; and then add Provider and store.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import { store } from './app/store';
import { Provider } from 'react-redux';


const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  &amp;lt;React.StrictMode&amp;gt;
    &amp;lt;Provider store={store}&amp;gt;
    &amp;lt;App /&amp;gt;
    &amp;lt;/Provider&amp;gt;
  &amp;lt;/React.StrictMode&amp;gt;
);

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

&lt;/div&gt;


&lt;p&gt;This will make reducer globally accessible.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make one component and add these things.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react'
from './counterSlice'
const Counter = () =&amp;gt; {


  const [incrementAmmount, setIncrementAmmount] = useState(0)


  return (
    &amp;lt;section&amp;gt;
      &amp;lt;p&amp;gt;0&amp;lt;/p&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;button }&amp;gt;+&amp;lt;/button&amp;gt;
        &amp;lt;button }&amp;gt;-&amp;lt;/button&amp;gt;

      &amp;lt;/div&amp;gt;
      &amp;lt;input
        type="text"
        value={incrementAmmount}
        }
      /&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;button &amp;gt;
          Add ammount
        &amp;lt;/button&amp;gt;
        &amp;lt;button &amp;gt;reset&amp;lt;/button&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;
  )
}

export default Counter

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

&lt;/div&gt;


&lt;p&gt;This is the stater coder &lt;em&gt;We are only focusing on redux-toolkit and not focusing on css&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Now we earlier in our &lt;code&gt;counterSlice&lt;/code&gt; we have made &lt;code&gt;multiple reducer&lt;/code&gt; and &lt;code&gt;initial state&lt;/code&gt;.&lt;br&gt;
Lets start bringing them on this component.&lt;/p&gt;

&lt;p&gt;Add this to our &lt;code&gt;Counter.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const count = useSelector((state) =&amp;gt; state.counter.count)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;useSelector()&lt;/code&gt; selects any element that is declared on our initial state.&lt;/p&gt;

&lt;p&gt;Now lets add function that we have created  to our button using dispatch()&lt;/p&gt;

&lt;p&gt;On &lt;code&gt;+&lt;/code&gt; button make it like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;button onClick={() =&amp;gt; dispatch(increment())}&amp;gt;+&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will make sure that whenever you click on add button it will call &lt;code&gt;increment()&lt;/code&gt; using &lt;code&gt;dispatch&lt;/code&gt;. So you can say that dispatch is help us call all the function that we have made on our slice.&lt;/p&gt;

&lt;p&gt;Try doing &lt;code&gt;-&lt;/code&gt; and &lt;code&gt;reset&lt;/code&gt; on your own.&lt;/p&gt;

&lt;p&gt;Lets do &lt;code&gt;add ammount&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;button onClick={() =&amp;gt; dispatch(incrementByAmmount(addValue))}&amp;gt;
          Add ammount
        &amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It takes ammount from our input variable and then sends the value to our reducer.&lt;/p&gt;

&lt;p&gt;So our whole Counter.js should look like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { increment, decrement, reset, incrementByAmmount } from './counterSlice'
const Counter = () =&amp;gt; {
  const count = useSelector((state) =&amp;gt; state.counter.count)
  const dispatch = useDispatch()
  const [incrementAmmount, setIncrementAmmount] = useState(0)

  const addValue = Number(incrementAmmount) || 0

  const resetAll = () =&amp;gt; {
    setIncrementAmmount(0)
    dispatch(reset())
  }
  return (
    &amp;lt;section&amp;gt;
      &amp;lt;p&amp;gt;{count}&amp;lt;/p&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;button onClick={() =&amp;gt; dispatch(increment())}&amp;gt;+&amp;lt;/button&amp;gt;
        &amp;lt;button onClick={() =&amp;gt; dispatch(decrement())}&amp;gt;-&amp;lt;/button&amp;gt;

      &amp;lt;/div&amp;gt;
      &amp;lt;input
        type="text"
        value={incrementAmmount}
        onChange={(e) =&amp;gt; setIncrementAmmount(e.target.value)}
      /&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;button onClick={() =&amp;gt; dispatch(incrementByAmmount(addValue))}&amp;gt;
          Add ammount
        &amp;lt;/button&amp;gt;
        &amp;lt;button onClick={resetAll}&amp;gt;reset&amp;lt;/button&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/section&amp;gt;
  )
}

export default Counter

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

&lt;/div&gt;



&lt;p&gt;And it should look like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2Fdfh9tuf85kumkdxkosn2.png" class="article-body-image-wrapper"&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%2Farticles%2Fdfh9tuf85kumkdxkosn2.png" alt="Image description" width="238" height="144"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Redux toolkit will make our life easier. Tough it's kind of confusing at first but once you get the hang of it you would be able to use it easy and efficiently. &lt;br&gt;
I will be making uploading another post about handling async function. And will try to upload a video about it asap. &lt;/p&gt;

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