首页 > 解决方案 > 类型错误:a 不是函数

问题描述

在我决定将项目移动到新的 ubuntu 系统之前,我的应用程序运行良好,当我尝试运行该程序时,它会抛出一个错误:

TypeError: a is not a function
 throw new Error('Expected the enhancer to be a function.')

我尝试查看我的 redux 商店设置,但一无所获。这是我的代码:

import { compose, createStore, applyMiddleware } from 'redux';
import { persistStore } from 'redux-persist';

import thunk from 'redux-thunk';
import persistedReducer from './reducers/index';

const store = createStore(
  persistedReducer,
  compose(
    window.__REDUX_DEVTOOLS_EXTENSION__ &&
      window.__REDUX_DEVTOOLS_EXTENSION__(),
    applyMiddleware(thunk),
  ),
);
const persistor = persistStore(store);
export { store, persistor };

标签: reactjsredux

解决方案


推荐阅读