Redux & Redux Toolkit
/Intermediate
Root Reducer
Definition
The top-level reducer function that combines multiple smaller, specialized reducer functions into a single reducer that manages the entire global state tree.
Explain Like I'm New
You don't want one massive 10,000-line reducer file managing the users, the shopping cart, and the dark mode theme. You split them up into `userReducer`, `cartReducer`, and `themeReducer`. The Root Reducer glues them all back together into one giant robot.
Real World Example
Using the `combineReducers()` utility. The resulting global state object will have keys that match the individual reducers, like `state.users`, `state.cart`, and `state.theme`.
Common Use Cases
- •Structuring large applications logically
- •Separation of concerns
Interactive Example
Loading Code Playground...
Interview Questions
basic
- What legacy Redux function was used to glue reducers together?
intermediate
- If an action is dispatched, does the Root Reducer send it to just one child reducer, or all of them?