Skip to content

Latest commit

 

History

History
3 lines (2 loc) · 684 Bytes

userReducer-vs-redux-reducer.md

File metadata and controls

3 lines (2 loc) · 684 Bytes

While useReducer with its reducer is a part of how Redux works, it isn’t Redux. The useReducer function is tightly coupled to its reducer which holds also true for its dispatch function. We dispatch action objects to that reducer only. Whereas in Redux, the dispatch function sends the action object to the store which distributes it to all its combined reducer functions. You can think of Redux as one global event bus which takes any events (actions) and processes them into a new state based on the action’s payload and the previous state.

In other words, Redux provides a global store where you can keep app data centralized. useReducer is localized to a specific component.