Advertisement
Beginner React, State Management Libraries (Redux, Zustand & Recoil)

What is Redux and what problem does it solve for larger React apps?

Short answer

Redux keeps all of an app's shared state in one single central store, and the only way to change that state is by sending a plain object called an action to a function called a reducer.

Save React mock interview
Advertisement
AModel answer
Redux keeps all of an app's shared state in one single central store, and the only way to change that state is by sending a plain object called an action to a function called a reducer. This makes it very clear and predictable how and why state changes, which becomes valuable in large apps with a lot of shared data.
const initialState = { count: 0 };

function counterReducer(state = initialState, action) {
  switch (action.type) {
    case 'increment': return { count: state.count + 1 };
    default: return state;
  }
}
Real-world example
A large e commerce app uses Redux to manage its shopping cart, user session, and notification data all in one predictable, central place, making it easier for a large team to understand exactly how and where state changes happen.
Likely follow-ups
  • Why did Redux become less commonly needed after the introduction of the Context API and hooks?
  • What is Redux Toolkit and how does it simplify writing Redux code?
Related topics