redux-persist can be used with redux, so how can redux-persist be used with dva.
redux-persist can be used with redux, so how can redux-persist be used with dva.
app.js
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
import autoMergeLevel2 from 'redux-persist/es/stateReconciler/autoMergeLevel2';
export const dva = {
config: {
onReducer(reducer) {
const persistConfig = {
key: 'root',
storage,
stateReconciler: autoMergeLevel2
}
return persistReducer(persistConfig, reducer)
},
onError(err) {
console.error(err);
},
},
};
window.onload = () => {
persistStore(window.g_app._store)
}
well, I still encountered this problem when configuring react-native to integrate dva and redux-persist