The introduction of Hooks in React brought up a new way of writing and thinking about React applications. One of the most popular Hooks among developers so far is useReducer, which allows us to handle some complex state manipulations and updates, and this is what we’ll be learning about in this article.

In React there are two main hooks that are used for state management, and we all know them. These are:

  • useState, and
  • useReducer

You might have heard or used React.useState hook, and if not you can directly read React’s official documentation about Hooks here.

Have you ever found any difficulty in choosing a state management library to manage and handle a global state in a React app? Or, what if you need to manage more complicated data structures or perform any side effects?Thinking over these concepts is quite tricky and time-consuming.

#react #javascript

Understanding the React useReducer Hook
3.55 GEEK