redux-persist saves Redux state to storage as it changes and restores it when the app starts. Wrap the root reducer with persistReducer and create a persistor beside the store.
Overview
The library watches your Redux store and writes selected slices to a pluggable storage engine whenever state updates. On launch, stored JSON is merged back into the initial state through a rehydration pass before or during first render.
Setup is intentionally small: persistReducer around the root reducer, persistStore on the store, and optional PersistGate in React to delay UI until rehydration finishes. useRehydrated offers a hook-based alternative without gating the tree.
Configuration controls allowlists and denylists, nested persists per branch, transforms on serialize, versioned migrations when shapes change, and choice of reconciler depth when merging. Built-in engines cover browser localStorage and sessionStorage; React Native AsyncStorage, IndexedDB, and filesystem backends plug in separately.
Server rendering with Next.js is supported: server passes store nothing while the browser loads persisted state from Client Components. Docs cover logout resets inside persisted reducers, tab sync recipes, encryption, and Redux Toolkit 2 compatibility in the v7 beta line.
Key features
- Automatic persist on state changes
- Pluggable storage engines
- Allowlist and denylist key filters
- Versioned schema migrations
- Nested per-reducer persistence
- React PersistGate loading gate
- Safe browser hydration pattern
- Transform hooks for serialization
Use cases
- Surviving app restarts with Redux state
- Persisting auth or preference slices
- React Native offline state retention
- Next.js hybrid server and client stores
- Selective persistence per feature branch