React context, Redux Toolkit, and Zustand all share state, but they solve different problems. Context is built into React and fits shared values with light updates.
Redux Toolkit scales complex, frequently changing global state. Zustand gives small stores with per-slice subscriptions and no provider boilerplate.
The core difference
Each tool trades a different amount of setup against control and performance. The table shows the main distinctions.
| Context | Redux Toolkit | Zustand | |
|---|---|---|---|
| Install | None | @reduxjs/toolkit + react-redux | zustand |
| Provider | Required | Required | Not required |
| Re-renders | Every reader | Selected slices | Selected slices |
| DevTools | None built in | Full time travel | Basic support |
| Learning curve | Low | Higher | Low |
Context is the simplest and most limited. The two libraries add subscription control and tooling at the cost of an extra dependency and more concepts.
When React context is enough
Context earns its place when a value changes rarely and many components read it. A theme, a locale, and the signed-in user are the canonical examples. You own the state with useState or useReducer and provide it through a provider.
- The value is shared by many components at different depths.
- Updates are infrequent.
- You already need providers for a small number of values.
For most apps starting out, context plus local state is the right amount of machinery.
When Redux Toolkit fits
Redux Toolkit suits global state that is complex, changes often, and is shared across features. Its single store, slices, middleware, and DevTools time travel help larger teams reason about state as a predictable sequence of actions.
import { configureStore, createSlice } from "@reduxjs/toolkit";
const cartSlice = createSlice({
name: "cart",
initialState: [],
reducers: {
added: (state, action) => {
state.push(action.payload);
},
},
});
export const store = configureStore({ reducer: { cart: cartSlice.reducer } });The store holds the cart slice and its reducer. Components read with useSelector and update with dispatch from react-redux. Redux Toolkit includes the immer library, so slice reducers can mutate state safely.
When Zustand fits
Zustand gives a global store without a provider and without Redux's boilerplate. You create a store as a hook, then select the exact slice a component needs.
import { create } from "zustand";
export const useCart = create((set) => ({
items: [],
add: (item) => set((state) => ({ items: state.items.concat(item) })),
}));A component subscribes to just the slice it uses and re-renders only when that slice changes, leaving the rest of the store untouched.
function CartCount() {
const count = useCart((state) => state.items.length);
return <span>{count} items</span>;
}No provider wraps the app. Zustand stores live in modules, and any component can import the hook and read a slice.
Which should you use
Match the tool to the pressure, not to fashion. Start with context and local state, then add a library only when a real limitation appears.
- Shared values that change rarely: context.
- Complex, frequently changing global state with a team: Redux Toolkit.
- Lightweight global store with fine-grained updates: Zustand.
If one component group owns the state and the rest just read it, context is usually enough. If many features write to the same global state, a library pays off.
What to learn next
The split between read and write contexts in how to split React context by responsibility handles many cases before a library is needed. For the create, provide, read basics, see the React context tutorial.
Rune AI
Key Insights
- Context is built in and needs no install.
- Redux Toolkit adds a single store, slices, and DevTools.
- Zustand needs no provider and subscribes per selector.
- Context re-renders all readers; Zustand re-renders per slice.
- Choose based on complexity, frequency, and team size.
Frequently Asked Questions
Is React context a state management library?
When should I reach for Redux Toolkit?
When is Zustand the better fit?
Conclusion
React context handles shared values with no extra dependency. Redux Toolkit scales complex, frequently changing global state with DevTools and middleware. Zustand gives lightweight stores and fine-grained subscriptions without providers. Start with context, and add a library when the state demands it.
More in this topic
How to Build a Dropdown Menu in React
Build a React dropdown menu with the ARIA menu button pattern. Handle open and close, keyboard arrows, and clicks outside the menu.
How to Animate React Components with Motion
Animate React components with the Motion library. Set up motion, add enter, hover, and exit animations, and respect reduced motion.
Headless UI Components Explained: Logic Without Locked Styling
Understand headless UI components and how libraries like Radix give you unstyled, accessible behavior that you style yourself.