RamAlx
RamAlx

Reputation: 7334

react.default.memo is not a function at createSvgIcon

I've updated my Material-UI version to 1.0.0, but I'm having this strange error that

_react.default.memo is not a function
    at createSvgIcon

I've done a little research and they say to downgrade the react redux library to 6.0.0, so I've done this but the error persists. The dependencies are these:

"dependencies": {
    "@material-ui/codemod": "^4.5.0",
    "@material-ui/core": "^1.0.0",
    "@material-ui/icons": "^4.5.1",
    "@material-ui/styles": "^4.7.1",
    "babel-polyfill": "~6.22.0",
    "browser-filesaver": "~1.1.1",
    "build-url": "~1.2.0",
    "es6-promise": "~4.2.5",
    "file-saver": "~2.0.1",
    "iban": "~0.0.8",
    "immutable": "~3.8.2",
    "jsdoc": "^3.6.3",
    "jsdoc-api": "~3.0.0",
    "loaders.css": "~0.1.2",
    "material-ui": "^0.20.2",
    "moment": "~2.20.1",
    "prop-types": "~15.6.0",
    "react": "~16.3.0",
    "react-datepicker": "~0.48.0",
    "react-dom": "~16.2.0",
    "react-feature-toggles": "~3.0.3",
    "react-intl": "~2.4.0",
    "react-loaders": "~3.0.1",
    "react-redux": "~6.0.0",
    "react-router": "~3.2.0",
    "react-tooltip": "~3.10.0",
    "redux": "~3.7.2",
    "redux-form": "~6.8.0",
    "redux-form-material-ui": "~4.3.3",
    "redux-immutable": "~4.0.0",
    "redux-persist": "~4.8.0",
    "redux-persist-immutable": "~4.3.1",
    "redux-saga": "~0.15.3",
    "whatwg-fetch": "~2.0.1"
  },
  "devDependencies": {
    "babel-core": "~6.26.0",
    "babel-eslint": "~7.1.1",
    "babel-loader": "~7.1.2",
    "babel-plugin-istanbul": "~3.1.2",
    "babel-plugin-transform-object-rest-spread": "~6.26.0",
    "babel-plugin-transform-runtime": "~6.23.0",
    "babel-preset-es2015": "~6.22.0",
    "babel-preset-react": "~6.22.0",
    "chai": "~3.5.0",
    "cross-env": "~6.0.3",
    "css-loader": "~0.26.0",
    "enzyme": "~3.6.0",
    "enzyme-adapter-react-16": "~1.5.0",
    "enzyme-react-intl": "~1.4.5",
    "enzyme-redux": "~0.1.8",
    "eslint": "~3.19.0",
    "eslint-config-airbnb": "~14.1.0",
    "eslint-loader": "~1.6.1",
    "eslint-plugin-import": "~2.2.0",
    "eslint-plugin-jsx-a11y": "~4.0.0",
    "eslint-plugin-react": "~6.9.0",
    "exports-loader": "~0.6.3",
    "file-loader": "~0.10.1",
    "html-loader": "~0.4.4",
    "html-webpack-plugin": "~2.28.0",
    "ignore-styles": "~5.0.1",
    "imports-loader": "~0.7.0",
    "istanbul": "~0.4.5",
    "jsdom": "~9.8.3",
    "jsdom-global": "~2.1.0",
    "json-loader": "~0.5.4",
    "mocha": "~5.0.1",
    "node-sass": "~4.13.0",
    "nyc": "~14.1.1",
    "react-test-renderer": "~16.5.2",
    "redux-saga-testing": "~1.0.5",
    "redux-test-utils": "~0.1.3",
    "sass-loader": "~4.1.1",
    "sinon": "~2.2.0",
    "style-loader": "~0.13.1",
    "webpack": "~3.10.0",
    "webpack-dev-server": "~2.11.1"
  },

Do you know why this error occurs?

Upvotes: 1

Views: 1276

Answers (1)

Ryan Cogswell
Ryan Cogswell

Reputation: 81006

In your dependencies, you are using the latest version of @material-ui/icons (v4.5.1). This version uses React.memo in createSvgIcon. React.memo was introduced in React 16.6, but you are using version 16.3 of React.

My recommendation would be to go to the latest version of React (16.12.0 for react and react-dom). This will give you more flexibility in which versions of other libraries you can leverage. At a minimum, you should upgrade React to at least 16.8 since the current versions of many libraries are dependent on React hooks.

Upvotes: 1

Related Questions