Redux TypeError:无法读取未定义的属性"apply" [英] Redux TypeError: Cannot read property 'apply' of undefined
本文介绍了Redux TypeError:无法读取未定义的属性"apply"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我禁用了react devtools和redux devtools.
I have disabled react devtools and redux devtools.
数小时以来,我一直在寻找解决此问题的方法,而大多数问题都是在编写中,而我根本不需要更改代码.
I've been searching for ways to deal with this problem for hours, and most of the problems are in compose while I don't change code at all.
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推送到我的存储库,然后在编译时突然出现此错误:
I really don't understand why this happened. I don't change anything and the last thing I do is just do git push origin master to my repository and suddenly when I compiled I got this error:
我在前端使用它:
"@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开发工具从2.16.0更新到2.16.1
Update your redux dev tools from 2.16.0 to 2.16.1
OR
从您的代码中删除此行
window.__REDUX_DEVTOOLS_EXTENSION__&& window.__REDUX_DEVTOOLS_EXTENSION__()
这篇关于Redux TypeError:无法读取未定义的属性"apply"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文