Nihal Parmar
2 min readApr 5, 2022

An Easy Way to Understanding React useReducer Hook

Hi Everone, this is my 1st Article regarding React Hooks. Here I am going to explain a very important and useful topic: React Hooks. This will be a brief explanation about useReducer Hook.

1st question will come to our mind … What is the useReducer hook?

useReducer is usually preferable useState when you have complex state logic that involves multiple sub-values or when the next state depends on the previous one. useReducer also lets you optimize performance for components that trigger deep updates because you can pass dispatch them down instead of callback.

In the code snippet, we have

  • first defined an initial state for our component
  • added a reducer function that updates that state depending on the action dispatched and,
  • we have finally initialized the state for our component.

If you have any suggestions so please suggest me so I will try to use them in my next article.

Follow me for new tidbits on the domain of tech.

Have a look at my Portfolio : https://nihalparmarportfolio.web.app/

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Nihal Parmar
Nihal Parmar

Written by Nihal Parmar

Software Engineer @Crest Data System|| 6⭐ @HackerRank || Tech-Enthusiast || GSSoC’21 || Full Stack Developer

No responses yet

Write a response