← Lessons

quiz vs the machine

Silver1100

Frontend

The Redux Core Concepts

Store, actions, and pure reducers that make application state predictable.

5 min read · intro · beat Silver to climb

What it is

Redux is a predictable state container built on three principles: a single source of truth, read only state, and changes made by pure functions.

The building blocks

  • Store: one object tree that holds the whole application state.
  • Action: a plain object with a type field describing what happened.
  • Reducer: a pure function that takes the previous state and an action and returns the next state.
  • Dispatch: the only way to trigger a state change.

Why reducers must be pure

A reducer must not mutate its arguments, call APIs, or read the clock. Given the same state and action it always returns the same result. This purity is what enables time travel debugging and reliable testing.

  • Never mutate state, return a new object instead.
  • Compute the next state only from inputs.
  • Keep side effects out of reducers.

Reading state

Components subscribe to the store and select the slices they need. When dispatch produces a new state, subscribers re render.

Key idea

Redux keeps all state in one store and changes it only through pure reducers, which makes every transition predictable and testable.

Check yourself

Answer to earn rating on the learn ladder.

1. What must a Redux reducer never do?

2. How many stores does a typical Redux app use?