Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

__WEBPACK_IMPORTED_MODULE_4_react___default.a.memo is not a function

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 [email protected] [email protected]

But it didn't work.

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

enter image description here

enter image description here

like image 455
Autumn's Fall Avatar asked Apr 15 '19 12:04

Autumn's Fall


2 Answers

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 [email protected] [email protected]

for more info click here

like image 99
Mukesh Tivari Avatar answered Sep 17 '22 20:09

Mukesh Tivari


This had happened to me as well. This happens when dependencies version gets updated, and the dependencies of the YouTube video you are watched has an old version.

Hence, replace the following dependencies in the 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 run npm install.

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

The above method should solve your problem.

like image 44
Rasika Weragoda Avatar answered Sep 18 '22 20:09

Rasika Weragoda