rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.94k stars 866 forks source link

How add path [login.user] to whitelist #1343

Closed shuijinliuxi closed 2 years ago

shuijinliuxi commented 2 years ago

Our app has many reducer, but I just want to save the login.user, so I set the code:

const userPersistConfig = {
    key: 'login',
    storage,
    whitelist: ['user']
};

const appPersistConfig = {
    key: 'app',
    storage,
    whitelist: ['loginReducer']
};

const rootReducer = combineReducers({ ...reducers, loginReducer: persistReducer(userPersistConfig, loginReducer) });

const persistedReducer = persistReducer(appPersistConfig, rootReducer);

but it not work…… It save the all data of loginReducer.

whayu901 commented 2 years ago

did you got solutions for this bro? because i also want to set up like this. @shuijinliuxi