反应还原是否需要与redux-persist一起使用?

时间:2018-01-23 10:57:02

标签: reactjs redux react-redux redux-persist

我使用的是React-native和Redux,但我的应用程序非常小而且简单,所以我认为redux-react不是必需的开销,所以我没有使用它。我只是在需要时导入商店,因为它无论如何都是单身人士。但是现在使用redux-persist我从App.js收到错误Path = C:\Program Files\MongoDB\Server\3.4\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Python27;C:\Python27\Scripts;C:\Python27\Lib\site-packages;%PYTHONHOME%;%PYTHONPATH; PYTHONHOME = C:\Python27 PYTHONPATH = C:\Python27\Lib;%PYTHONHOME% ,所以我想这可能是因为我没有使用商店提供商。这是真的吗?

configureStore.js

"TypeError: undefined is not an object (evaluating 'this.props.persistor.subscribe')"

App.js

import { createStore } from 'redux';
import { persistStore, persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import rootReducer from './reducers/reducer';

const persistConfig = {
    key: 'root',
    storage: storage,
}

const persistedReducer = persistReducer(persistConfig, rootReducer);

let store = createStore(persistedReducer);
let persistor = persistStore(store);

export default { store, persistor };

感谢您的帮助

0 个答案:

没有答案