我已经添加,redux 坚持到我的应用程序。我有一个根减速器,其中包含不同的减速器,如“Auth”、“Orders”、“Products”、“Transactions”等。
问题是我的 Orders and Products reducer 已正确保留,但 Auth 和 Transactions reducer 没有保留。
我试过调试,我在 root reducer 的 Auth 和 Transactions 切片中看不到任何数据
这是我的顶级配置
const persistConfig = {
key: 'root',
storage,
// blacklist: ['navigation'] pass state which you want to ignore
blacklist: ['navigation', 'Error', 'Address', 'form'],
stateReconciler: autoMergeLevel2,
};
const pReducer = persistReducer(persistConfig, rootReducer);
出口喜欢
export const configureStore = createStore(pReducer, composeEnhancers(applyMiddleware(thunk)));
export const persistor = persistStore(configureStore);
在我的 App.js 中
<Provider store={store}>
{/* the loading and persistor props are both required! */}
<PersistGate loading={<Spinner />} persistor={persistor}>
<CommuneVendorRoot />
</PersistGate>
</Provider>