https://github.com/rt2zz/redux-persist包含以下示例
我认为,如果您将auth
列入黑名单,则整个reducer都将被列入黑名单。
为什么在somethingTemporary
内再次将auth
列入黑名单?
import { combineReducers } from 'redux'
import { persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
import { authReducer, otherReducer } from './reducers'
const rootPersistConfig = {
key: 'root',
storage: storage,
blacklist: ['auth']
}
const authPersistConfig = {
key: 'auth',
storage: storage,
blacklist: ['somethingTemporary']
}
const rootReducer = combineReducers({
auth: persistReducer(authPersistConfig, authReducer),
other: otherReducer,
})
export default persistReducer(rootPersistConfig, rootReducer)
如果要将嵌套键foo.bar
列入白名单,白名单又如何呢?您应该在顶层将foo
列入白名单,在bar
级别将foo
列入白名单吗? / p>