Repolode
endograph

endograph/redux-persist

A Redux middleware-style library that saves store state to storage and restores it when the app starts.

Stars
12,950
Forks
839
Open issues
1
Last commit
14 days ago

What is it?

redux-persist saves a Redux store's state to storage as it changes and rehydrates it into the store on startup, so users keep their data across page loads or app launches. You wrap your root reducer with persistReducer and create a persistor with persistStore; the rest of the app stays the same, and Redux Toolkit works without extra setup.

Storage is pluggable. localStorage and sessionStorage are included for the web, and AsyncStorage, IndexedDB, the filesystem and other backends can be used through storage engines. Developers choose which top-level keys are saved with allowlist and denylist, can nest persisted reducers for finer control, and can transform state on the way in and out.

The library also handles versioned state. Migrations upgrade stored data when its shape changes, and the React bindings include PersistGate and useRehydrated to delay rendering until stored state has loaded.

Key features

  • 01Wraps the root reducer with persistReducer and creates a persistor with persistStore.
  • 02Ships localStorage and sessionStorage support, with pluggable storage engines for other backends.
  • 03Lets you choose saved keys with allowlist and denylist, or with a filter function.
  • 04Supports nested persists, state transforms and versioned migrations.
  • 05Provides PersistGate and useRehydrated for React to wait until state is restored.

Use cases

  • Keeping user preferences or login-related state across browser reloads in a React app.
  • Persisting Redux state in a React Native app backed by AsyncStorage.
  • Saving app state offline in a PWA or desktop app that uses IndexedDB or the filesystem.
  • Upgrading stored state safely when the shape of a Redux slice changes between releases.

Quick start

  1. 1

    Install the package from npm

    npm install redux-persist
  2. 2

    Wrap your root reducer with persistReducer and create a persistor with persistStore in your store file

  3. 3

    Wrap your root component in PersistGate from redux-persist/react (optional, for React)

Things to know

  • Redux Toolkit 2 or Redux 5 is required for v7.
  • The v7 release is in beta (install with the next tag).

Topics

FAQ

What is redux-persist?
A Redux middleware-style library that saves store state to storage and restores it when the app starts. redux-persist saves a Redux store's state to storage as it changes and rehydrates it into the store on startup, so users keep their data across page loads or app launches. You wrap your root reducer with persistReducer and create a persistor with persistStore; the rest of the app stays the same, and Redux Toolkit works without extra setup.
Is redux-persist free to use? What license does it have?
redux-persist is open source under the MIT license. Check the license terms before using it in commercial products.
Is redux-persist still maintained?
Actively maintained. The last commit to redux-persist was on Oct 7, 2026.
What can I use redux-persist for?
Keeping user preferences or login-related state across browser reloads in a React app. Persisting Redux state in a React Native app backed by AsyncStorage. Saving app state offline in a PWA or desktop app that uses IndexedDB or the filesystem. Upgrading stored state safely when the shape of a Redux slice changes between releases.
How do I install redux-persist?
Install the package from npm: npm install redux-persist Wrap your root reducer with persistReducer and create a persistor with persistStore in your store file Wrap your root component in PersistGate from redux-persist/react (optional, for React)
Where can I get redux-persist?
The source code and installation instructions are on GitHub: https://github.com/endograph/redux-persist

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects