Redux-persist TypeError:超级表达式必须为null或函数(16.13.1)

时间:2020-10-28 05:01:44

标签: reactjs redux react-redux redux-persist

为什么redux-persist抛出 TypeError:超级表达式必须为null或函数,我关注了redux-persist文档,并且正在使用函数组件。有什么解决办法吗?

Storeconfig.ts

const persistConfig = {
    key: 'root',
    storage,
    whitelist: ['authentication']
}
const rootReducer: any = combineReducers({
    authentication: Auth,
    profile: Profile,
    events: Events,
    loadUser: LoadUser
})

const persistedReducer = persistReducer(persistConfig, rootReducer);


const initState = {};
export const store: any = createStore(
    persistedReducer,
    initState,
    composeWithDevTools(applyMiddleware(thunk))
);


export const persistedStore = persistStore(store)

Index.ts

ReactDOM.render(
  <React.StrictMode>
    <Provider store={store}>
      <PersistGate loading={null} persistor={persistedStore}>
        <Router>
          <App />
        </Router>
      </PersistGate>
    </Provider>
  </React.StrictMode>,
  document.getElementById("root")
);

Package.json

    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "redux": "^4.0.5",
    "react-redux": "^7.2.1",
    "redux-persist" "6.0.0"

0 个答案:

没有答案