当前位置 : 主页 > 网页制作 > React >

reactjs – Redux TypeError:无法读取undefined的属性’apply’

来源:互联网 收集:自由互联 发布时间:2021-06-15
我已经禁用反应devtools和redux devtools. 我一直在寻找解决这个问题几个小时的方法,而且大部分问题都在撰写,而我根本就没有改变代码. import { createStore, applyMiddleware,compose } from 'redux';impo
我已经禁用反应devtools和redux devtools.

我一直在寻找解决这个问题几个小时的方法,而且大部分问题都在撰写,而我根本就没有改变代码.

import { createStore, applyMiddleware,compose } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from './reducers';

const initialState={};

const middleware = [thunk];

const store = createStore(rootReducer,initialState,
    compose(
        applyMiddleware(...middleware),
        window.__REDUX_DEVTOOLS_EXTENSION__&& window.__REDUX_DEVTOOLS_EXTENSION__()
        )   
    );


export default store;

我真的不明白为什么会这样.我没有改变任何东西,我做的最后一件事就是把git push origin master放到我的存储库中,突然间我编译时遇到了这个错误:

Iam在我的前端使用这个:

"@material-ui/core": "^3.3.1",
    "@material-ui/icons": "^3.0.1",
    "axios": "^0.18.0",
    "jwt-decode": "^2.2.0",
    "prop-types": "^15.6.2",
    "react": "^16.6.0",
    "react-dom": "^16.6.0",
    "react-redux": "^5.1.0",
    "react-router-dom": "^4.3.1",
    "react-scripts": "2.0.5",
    "react-select": "^2.1.1",
    "recharts": "^1.3.5",
    "redux": "^4.0.1",
    "redux-thunk": "^2.3.0",
    "typeface-roboto": "0.0.54"

后端:

"dependencies": {
    "bcryptjs": "^2.4.3",
    "body-parser": "^1.18.3",
    "express": "^4.16.4",
    "mongoose": "^5.3.11",
    "multer": "^1.4.1",
    "passport": "^0.4.0",
    "passport-jwt": "^4.0.0",
    "path": "^0.12.7",
    "validator": "^10.9.0",
    "xlsx": "^0.14.1"
  },
  "devDependencies": {
    "concurrently": "^4.0.1",
    "nodemon": "^1.18.6",
  },

结果错误:

Redux:

将redux dev工具从2.16.0更新到2.16.1

要么

从代码中删除此行

window.__REDUX_DEVTOOLS_EXTENSION__&& window.__REDUX_DEVTOOLS_EXTENSION__()
网友评论