I've combined redux-persist
with Redux to keep the state between app restarts. Currently, on the dev build, it never keeps the state.
My store
const persistConfig = {
key: 'root',
storage: AsyncStorage,
blacklist:['users', 'activity', 'meeting', 'workshop', 'predavanja', 'klizni', 'meetings', 'standing']
}
const allReducers = combineReducers({
darkMode: persistReducer(persistConfig, darkReducer),
users: userReducer,
activity: activity,
meeting: meeting,
workshop: workshop,
predavanja: predavanja,
klizni: klizni,
meetings: meetings,
standing: standing,
});
I keep logging the state of the state I want to persist but it keeps returning to the default state.
Is there any reason, you decided to blacklist each reducer in the config? If you are trying to persist all your Redux state, you should not define any blacklist. Furthermore, I can't see, how you are creating your redux store, but it should look something like
In your root component, you should inject the store like the following:
The reducers should look like in the following code snippet:
If you follow all these steps, your whole redux store should be persisted.