[英]How to store only a part of the redux state using redux-persist
我如何使用redux-persist只存儲redux-state的一部分。 例如我有以下狀態
const initialState = {
data: [],
fetched: false,
loadingUser: false
}
我如何只存儲數據而不保存已獲取和加載的用戶布爾值與redux-persist
您可以使用文檔中概述的白名單和黑名單功能。
//in your redux store config
const persistConfig = {
key: 'root',
storage: storage,
whitelist: ['data'] // only data will be persisted
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.