PersistGatae导致无法读取未定义错误的属性“订阅”

时间:2019-09-10 07:59:40

标签: react-native redux redux-persist

我试图弄清楚如何使用Redux-Persist。我的index.js中包含以下代码:

import { AppRegistry, View } from "react-native";
import React from "react";
import App from "./App";
import { name as appName } from "./app.json";
import { Provider } from "react-redux";
import { PersistGate } from "redux-persist/integration/react";
import storeConfig from "./app/config/store";

const AppRedux = () => (
  <Provider store={storeConfig.store}>
    <PersistGate presistor={storeConfig.persistor} loading={null}>
      <App />
     </PersistGate>
  </Provider>
);
AppRegistry.registerComponent(appName, () => AppRedux);

运行它时,我收到以下消息:

  

未处理的JS异常:TypeError:无法读取未定义的属性'subscribe'

但是,当我注释掉PersistGate时,我没有任何问题,我的商店也补水了。

我要保留PersistGate的原因是在补液时出现闪屏。关于如何解决此问题有什么建议吗?

P.S。这就是我存储文件中的内容:

export default () => {
  const pReducer = persistReducer(persistConfig, reducers);
  const store = createStore(pReducer, {}, applyMiddleware(logger));
  const persistor = persistStore(store);
  return { store, persistor };
};

0 个答案:

没有答案