API Reference

Redux

Predictable state container for JavaScript apps using a single store, actions and pure reducers.

Official Documentation ↗
CompatibilityThis documentation covers version redux v5.x / Node 18 LTS 与浏览器. Check the official docs for the latest API surface.

Installation

npmnpm install redux
pnpmpnpm add redux
yarnyarn add redux

Methods

Overview

Redux keeps application state in a single store updated only by pure reducers in response to dispatched actions. This makes state transitions explicit and traceable through devtools.

Core Methods

createStore or configureStore builds the store, dispatch sends actions, getState reads snapshot state and subscribe notifies listeners. combineReducers composes slice reducers into a root reducer.

Usage Notes

Model each slice with one reducer, keep reducers pure and synchronous, and handle async work with middleware such as thunk. Use selectors to decouple components from state shape.

Common Pitfalls

Mutating state in reducers breaks equality checks and time travel. Putting non-serializable values in state hinders devtools and persistence. Overusing Redux for trivial state adds ceremony without benefit.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://redux.js.org/ · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:52:06.718Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

  • Redux’s architecture lets you log changes, use “time-travel debugging” , and even send complete error reports to a server. (https://redux.js.org/)

FAQ

Why is createStore deprecated?
Modern Redux favors Redux Toolkit configureStore, which wraps createStore with sensible defaults, middleware and devtools. createStore remains for simple cases and library usage.
When should I use Redux?
Use it when state is shared widely, updates need to be traceable, or many components depend on the same data. For simple local state, React state or a smaller store is enough.
How does Redux differ from Zustand or Jotai?
Redux centralizes state in one store with explicit actions and reducers and strong tooling. Zustand and Jotai offer lighter, hook-centric models with less ceremony, trading some structure for simplicity.