gpt4 book ai didi

javascript - Redux 类型错误 : Cannot read property 'apply' of undefined

转载 作者:行者123 更新时间:2023-12-03 13:09:04 24 4
gpt4 key购买 nike

我已经禁用了 React devtools 和 redux devtools。

我几个小时以来一直在寻找解决这个问题的方法,大多数问题都在 compose 中,而我根本不更改代码。

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 到我的存储库,突然当我编译时我得到了这个错误:

我在我的前端使用它:

  "@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",
},

结果错误:

Image Error 1

Redux:

Image Error 2

最佳答案

将您的 redux 开发工具从 2.16.0 更新到 2.16.1

或者

从代码中删除此行

window.__REDUX_DEVTOOLS_EXTENSION__&& window.__REDUX_DEVTOOLS_EXTENSION__()

关于javascript - Redux 类型错误 : Cannot read property 'apply' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53514758/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com