如何使用redux-persist仅存储Redux状态的一部分。例如我有以下状态
const initialState = {
data: [],
fetched: false,
loadingUser: false
}
我如何只存储数据而不保存带有redux-persist的fetched and loadUser布尔值
答案 0 :(得分:1)
您可以使用whitelist and blacklist functionality, as outlined in the documentation.
//in your redux store config
const persistConfig = {
key: 'root',
storage: storage,
whitelist: ['data'] // only data will be persisted
};