Redux is a library for managing application state outside of components. A single store holds the state tree, actions describe what happened, and pure reducers compute the next state, so every change is explicit, reproducible and inspectable. It is most often used with React, but the core works with any UI layer or even plain JavaScript.
The official site explains the three principles, the store, actions, reducers and dispatch, then introduces Redux Toolkit as the recommended way to write slices, reducers and async thunks with far less boilerplate. Further guides cover data fetching, TypeScript setup, immutable update patterns, devtools, testing, migration from older APIs and the React bindings.
It suits applications where many distant components need the same data, teams that value traceable state transitions and time travel debugging, products with complex server cache and optimistic update logic, and developers maintaining a large existing codebase built around a central store.
Compared with component local state it adds structure and cross component sharing at the cost of extra concepts; compared with lightweight context based solutions it offers stronger debugging and middleware support; for purely local UI state, a simpler hook is often enough and mixing both approaches is common.
Start new code with Redux Toolkit rather than hand written action constants, keep serializable values in the store, use the devtools to replay unexpected transitions, and avoid putting every piece of transient form or hover state into the global store.
407106872@qq.com
Copyright © 2026 Torv.cn All Rights Reserved.