__WEBPACK_IMPORTED_MODULE_4_react___default.a.memo is not a function

半世苍凉 提交于 2020-01-13 08:37:04

问题


I just connect the app with redux and react-redux connect function, together with state and dispatches. It compiled without problems but the results are not showing. And it looks like below.

I tried to find it and found that i have to change react version.

$ sudo npm install --save react@16.4.0 react-dom@16.4.0

But it didn't work.

I am following this tutorial. https://www.youtube.com/watch?v=BxzO2M7QcZw


回答1:


This is also happen to me. What I figure it out is that this is happen because of dependencies' version is now updated, But the dependencies of the youtube video that you watched were older than these days.

so repalce these dependencies of you package.json file

"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"redux": "^4.0.0",
"redux-thunk": "^2.3.0",

and do npm install

Since connect() function connects a React component to a Redux store, react, redux need to be version supported, If you willing to use newest dependencies please refer the documentation of redux

I think that above dependencies solve your problem.




回答2:


you're using wrong version of React, React.memo is introduced with version 16.6.0 so, try this command to install the right version

npm install --save react@16.6.0 react-dom@16.6.0

for more info click here




回答3:


That's because @material-ui/styles has a peer dependency on react >= 16.7.0-alpha.0 and react-dom >= 16.7.0-alpha.0 that include hooks. To use @material-ui/styles, change your react and react-dom dependencies like this:

"dependencies": {

...

"react": "^16.7.0-alpha.2",
"react-dom": "^16.7.0-alpha.2",
...

},



来源:https://stackoverflow.com/questions/55689238/webpack-imported-module-4-react-default-a-memo-is-not-a-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!