ReactJS 16.4 and Material UI 4.x compatibility

房东的猫 提交于 2021-01-28 19:58:15

问题


I am using React 16.4.1 and metrial-ui 4.1.1 and when i tried to run it locally i am getting the following Error.

TypeError: _react.default.memo is not a function
createSvgIcon
c:/apps/projects/app/node_modules/@material-ui/icons/utils/createSvgIcon.js:17
  14 | var _SvgIcon = _interopRequireDefault(require("@material-ui/core/SvgIcon"));

And the node and npm versions i have locally (on windows) are 10.16.0 and 6.9.0

When i build the same using Jenkins (running on linux) with node 10.13.0 and npm 6.9.1 it is running fine.

Not sure why such a minor version mismatches are causing this issue.

Thanks Sateesh


回答1:


Unfortunately, React.memo was released in react@16.6.0 source.

It appears that @material-ui/core@4.0.0 (even before 4.1.1) requires react@16.8.0 source.

For what it's worth, there shouldn't be much difficulty in upgrading your React version to even the latest version. The biggest pain point will be if you use a library like enzyme (or other dependencies that try to keep up with exact API parity). You'd need to also update that and it's partnering dependencies.



来源:https://stackoverflow.com/questions/56811531/reactjs-16-4-and-material-ui-4-x-compatibility

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