如何保持状态减速的所有切片,用终极版坚持?

问题描述 投票:0回答:1

我已经加入,终极版坚持到我的应用程序。我有一个根减速机包含不同的减速,如“验证”,“订单”,“产品”,“交易”等。

问题是我的订单和产品减速机正常持续,但验证和交易减速器不存在。

我试着调试,我可以看到根减速的验证和交易片没有数据

这是我的顶级配置

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>
javascript react-native react-redux redux-persist react-state-management
1个回答
0
投票
import { persistCombineReducers } from 'redux-persist'
import storage from 'redux-persist/es/storage'
import todos from '../reducers/reducers';
import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2';

console.log(todos)
const config = {
  key: 'root',
  storage: storage,
  debug: true,
  stateReconciler: autoMergeLevel2
};


const rootReducer = persistCombineReducers(config, {
  Transactions: todos
});
export default rootReducer;

请检查上面的代码工作正常。让我知道,如果你还有什么问题

© www.soinside.com 2019 - 2024. All rights reserved.