What is Redux?

Think of Redux as a super-organized notebook for your React app’s data. It keeps everything in one predictable place, so you’re not running around passing props up and down your component tree like you’re delivering pizzas without GPS.

Vivek Rastogi

8/19/20252 min read

a close up of a sign on a wall
a close up of a sign on a wall
What is Redux?

Redux is a state management library.

  • React manages local state just fine (using useState), but when many components need the same data, things get messy.

  • Redux stores global state in one central object (called the store), so every component can access or update it directly.

Why do we use Redux?

We use Redux when:

  • Many components need the same data (e.g., user info, theme, cart items).

  • Data needs to stay consistent across the whole app.

  • Passing props becomes messy when your app grows.

  • Debugging is hard — you want to track every change in one place.

Advantages of Redux
  1. Single Source of Truth

    • All your state is in one store → easier to manage, debug, and reason about.

  2. Predictable State Changes

    • State changes only through actions and reducers → no unexpected mutations.

  3. Easier Debugging with DevTools

    • You can literally see every state change and even go “time traveling” (undo/redo).

  4. No Prop Drilling

    • Any component can access global state directly — no need to pass props through multiple levels.

  5. Easier for Large Teams

    • Code becomes more structured → every change follows the same pattern (dispatch action → reducer updates state).

  6. Great for Async Data (with Redux Toolkit)

    • Fetching API data and storing it globally becomes clean and organized.

Core Concepts

Redux has three main pieces:

  1. Store → The single source of truth (your app’s state lives here).

  2. Actions → Plain objects describing what happened (e.g., { type: "INCREMENT" }).

  3. Reducers → Functions that take the old state + action and return a new state (pure functions).

Simple Example: Counter App
1. Install Redux + React bindings

npm install @reduxjs/toolkit react-redux

(Redux Toolkit is the modern way to write Redux — less boilerplate, fewer headaches.)

2. Create a Redux slice (state + reducers together)

2. Set up the Redux store
3. Provide the store to your app
4. Use Redux state in components
When NOT to use Redux
  • If your app is small and only uses local state (useState, useContext is enough).

  • If you just have a few components sharing state — Redux might be overkill.

In one line:

Redux is like having a centralized bank for your app’s data, instead of hiding cash in different drawers (components).