
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
react-redux-persist
Advanced tools
This is a library that helps you to persist your redux store and rehydrate it when the app is reloaded. It uses the local storage, session storage or cookies to store the data.
This is a library that helps you to persist your redux store and rehydrate it when the app is reloaded. It uses the local storage, session storage or cookies to store the data. Project is written in TypeScript. However, you can use it in JavaScript projects as well.
npm install react-redux-persist
yarn add react-redux-persist
import { configureStore, createSlice } from "@reduxjs/toolkit";
import {
PersistConfig,
persistReducer,
persistStore,
} from "react-redux-persist";
// Example of a reducer
const exampleSlice = createSlice({
name: "example",
initialState: {
value: 0,
},
reducers: {
increment: (state) => {
state.value += 1;
},
},
});
// Here you will pass all your reducers
const reducers = {
example: exampleSlice.reducer,
};
// Create a configuration for the persist
const configs: PersistConfig = {
key: "root", // Key to store the data
storage: {
type: "localStorage", // Type of storage (local, session or cookies)
},
};
const persistReducers = persistReducer(configs, reducers);
const store = configureStore({
reducer: persistReducers.combinedReducers,
preloadedState: persistReducers.preloadedState,
});
const persistor = persistStore(store, configs);
export default persistor;
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;
or you can use
import { legacy_createStore as createStore } from "redux";
import {
PersistConfig,
persistReducer,
persistStore,
} from "react-redux-persist";
// Example of a reducer
const initialState = {
value: 0,
};
const exampleReducer = (state = initialState, action) => {
switch (action.type) {
case "INCREMENT":
return {
...state,
value: state.value + 1,
};
default:
return state;
}
};
// Create a configuration for the persist
const configs: PersistConfig = {
key: "root", // Key to store the data
storage: {
type: "localStorage", // Type of storage (local, session or cookies)
},
};
// Here you will pass all your reducers
const reducers = {
example: exampleReducer,
};
const persistReducers = persistReducer(configs, reducers);
const store = createStore(
persistReducers.combinedReducers,
persistReducers.preloadedState,
);
const persistor = persistStore(store, configs);
export default persistor;
import React from "react";
import { BrowserRouter as Router } from "react-router-dom";
import { Provider } from "react-redux";
import store from "./redux/store"; // Is the persistor that you created and exported in the previous step
function App() {
return (
<Provider store={store}>
<Router>{/* Your components */}</Router>
</Provider>
);
}
MIT
Gabriel Logan
FAQs
This is a library that helps you to persist your redux store and rehydrate it when the app is reloaded. It uses the local storage, session storage or cookies to store the data.
We found that react-redux-persist demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.