微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

模块导出不适用于 redux 持久化

如何解决模块导出不适用于 redux 持久化

我正在我的 React 项目中实施 redux-persist,但我的模块导出无法正常工作。

我有一个 store.js 文件

store.js

我有我的 index.js 文件

index.js

我继续在 index.js 文件中收到此错误

Attempted import error: 'persistor' is not exported from './store/store'.

我不知道此时我需要做什么。我已经尝试了所有我能想到的方法包括使用 module.export.store 等单独添加它们。

编辑:

我这样改了还是不行

const persistConfig = {
    key: "root",storage,stateReconciler: autoMergeLevel2,};

const pReducer = persistReducer(persistConfig,reducer);
const store = createStore(pReducer,devToolsEnhancer());
const persistor = persistStore(store);

module.exports = {
    store,persistor,};

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。