我在ReduxPersist的 GitHub 页面上找不到任何东西
我有一段我试图理解的代码,因为它被删除了,autoRehydrate
我想知道应该如何使用.redux-persist
import { AsyncStorage } from 'react-native';
import { applyMiddleware, createStore } from 'redux';
import { autoRehydrate, persistStore } from 'redux-persist'
import thunk from 'redux-thunk';
import reducers from '../reducers';
const middleWare = [thunk];
const createStoreWithMiddleware = applyMiddleware(...middleWare)(createStore);
export default configureStore = (onComplete) => {
const store = autoRehydrate()(createStoreWithMiddleware)(reducers);
persistStore(store, { storage: AsyncStorage }, onComplete);
return store;
};
我找到了一些教程,但它只是说这autoRehydrate
必须存在,但没有解释它的实际作用。