For questions regarding the redux-persist package, which preserves redux state using a persistent data store such as localStorage on the web or AsyncStorage in react-native apps.
Questions tagged [redux-persist]
513 questions
85
votes
10 answers
How to solve: console.error: "redux-persist failed to create sync storage. falling back to "noop" storage
I'm trying to setup redux-persist in a react native app.
However I'm hitting this error:
console.error: "redux-persist failed to create sync storage. falling
back to "noop" storage
I've tried to change the storage from storage to AsyncStorage in…

user1872384
- 6,886
- 11
- 61
- 103
59
votes
5 answers
How to configure redux-persist with redux-toolkit?
I have configured redux-persist with a traditional react-redux setup like this:
onst persistConfig = {
key: 'root',
storage,
whitelist: ['todos'],
};
const persistedReducer = persistReducer(persistConfig, reducer);
const store =…

Ashik
- 2,888
- 8
- 28
- 53
17
votes
4 answers
How to wait for Redux Persist to rehydrate before ending test
I have the following code:
const App = () => {
return (
Loading!}>
…

user4184113
- 976
- 2
- 11
- 29
17
votes
1 answer
Why use redux-persist over manually persisting state to localStorage?
Another way to ask would be, if you really only want to start your app up with the data saved in localStorage (rehydrate) and save every redux state change to localStorage (persist) is using redux-persist any better than using your own solution like…

mezod
- 2,313
- 3
- 21
- 31
15
votes
4 answers
Using redux with redux-persist with server-side rendering
I am trying to implement redux 4.0.0 with redux-persist 5.10.0 in an SSR application and am running into an issue where I cannot properly supply createStore() with the preloaded state without the app crashing.
What happens is that the application…

Gurnzbot
- 3,742
- 7
- 36
- 55
14
votes
2 answers
React Native, the Android lifecycle and navigation
We are building a React Native app that uses redux-persist to store the app state, including the navigation state. I would like for this app to behave like a native app in terms of navigation:
When a native Android app goes into the background, is…

sAm_vdP
- 331
- 2
- 7
12
votes
2 answers
How to add redux-persist to typescript project?
I'm trying to add redux-persist to my React project (using typescript). But I have some trouble. Compiling falls with following error:
Could not find a declaration file for module 'redux-persist/lib/storage'.…

Слава Иванов
- 435
- 1
- 5
- 14
12
votes
5 answers
redux-persist - how do you blacklist/whitelist nested state
So I have a credentials object which contains a password and a username
payload: Object
credentials: Object
password: ""
username: ""
and I want to blacklist password in the reducer configuration, something like
const authPersistConfig =…

David Browning
- 141
- 1
- 1
- 4
11
votes
2 answers
How to prevent redux-persist from using LocalStorage before it has been allowed by the user?
I would like to get the user's consent with a click on a banner button before I use LocalStorage. LocalStorage is used through redux-persist. I'm using redux and redux-persist as follows:
ReactDOM.render(

Kalle Richter
- 8,008
- 26
- 77
- 177
11
votes
2 answers
IndexedDB size keeps growing even though data saved doesn't change
I am using Redux Persist and LocalForage in my web application.
I have a series of actions that are fired upon login that update some data about the user. The IndexedDB size after all actions are fired and the data is saved in the JSON format on…

slyfox42
- 143
- 7
11
votes
4 answers
React Native Navigation and Redux Persist
I am trying to integrate redux-persist with wix react-native-navigation. However, I am unable to find any examples or documentation stating the boilerplate code needed to integrate the both libraries.
I was wondering if anyone would like to share…

Kamil Kamili
- 1,757
- 5
- 24
- 39
10
votes
3 answers
React Native 'PersistGate' cannot be used as a JSX component. Its instance type 'PersistGate' is not a valid JSX element
I am using @redux/toolkit with redux-persist in a react native application with TypeScript.
store.ts
import { configureStore } from '@reduxjs/toolkit';
import { combineReducers } from 'redux';
import { persistReducer, persistStore } from…

Md. Moniruzzaman
- 637
- 6
- 21
10
votes
2 answers
Jest Redux Persist: TypeError: Cannot read property 'catch' of undefined at writeStagedState
I'm trying to test my LoginScreen with Jest and Typescript. I use redux and redux-persist for storage and have set the storage up to use AsyncStorage as part of the config. I suspect that redux-persist is attempting to rehydrate after the built-in…

Mosef
- 217
- 4
- 11
10
votes
3 answers
action.rehydrate is not a function
I have been getting the following error since sometime in my console, i have no idea what it means and why it is originating. Please spread some light on this matter.
it says:
persistReducer.js:50 Uncaught TypeError: action.rehydrate is not a…

Skaranjit
- 764
- 9
- 26
9
votes
0 answers
How to persist redux state in Next.js without blocking SSR?
I have a serverless Next.js app in which there are some components that depend on data passed down from the redux store. Currently my method requires redux-persist to save the store as the user navigates, otherwise the aforementioned components will…

HJEC
- 400
- 3
- 11