React Hooks are so powerful and especially some additional hooks.
Do you know there is an alternative to useState called useReducer hook? It is used to manage more complex states.
Let's look into detail ๐งต๐๐ป
Usually, the useState hook is used to tackle states in React where you can pass the initial state and React preserves state for you between re-renders
What if you need to manage more complex states? Here useReducers comes into play
Similar to useState, the useReducer hook also returns a pair of values. Let's see what these two things are
The first value is `undefined` which is the current state (it is undefined because we didn't pass any initial state in the useReducer hook)
The second value is a dispatch function using which we can update our state.
The useReducer hook accepts 3 parameter
1. reducer
2. Initial state
3. init