📜  redux-persist - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:08.201000             🧑  作者: Mango

代码示例1
// configureStore.js import { createStore } from 'redux'import { persistStore, persistReducer } from 'redux-persist'import storage from 'redux-persist/lib/storage' // defaults to localStorage for web import rootReducer from './reducers' const persistConfig = {  key: 'root',  storage,} const persistedReducer = persistReducer(persistConfig, rootReducer) export default () => {  let store = createStore(persistedReducer)  let persistor = persistStore(store)  return { store, persistor }}