Reducer Hooks versus State Hooks
In the previous chapter, we learned about dealing with local and global states. We used State Hooks for both cases, which is fine for simple state changes. However, if our state logic becomes more complicated, we are going to need to ensure that we keep the state consistent. To do so, we should use a Reducer Hook, instead of multiple State Hooks, because it is harder to maintain synchronicity between multiple State Hooks that depend on each other. As an alternative, we could keep all states in one State Hook, but then we have to make sure that we don’t accidentally overwrite parts of our state.
Limitations of the State Hook
The State Hook already supports passing complex objects and arrays to it, and it can handle their state changes perfectly fine. However, we are always going to have to change the state directly, which means that we need to use a lot of destructuring to make sure that we are not overwriting other parts of the state...