简体   繁体   中英

Upgrade material ui project from v0.20 to v1

it's mandatory for our project to upgrade our material ui version at least initially to version 1. Our project scaled up and the current version makes us problems. Our current version is v0.20.2 It's really old as you can see haha I follow the https://material-ui.com/guides/migration-v0x/ but the following error occurs:

    Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See httpsinvalid-hook-call for tips about how to debug and fix this problem.
    at resolveDispatcher (react.development.js:1590)
    at useMemo (react.development.js:1642)
    at Provider (Provider.js:10)
    at mountIndeterminateComponent (react-dom.development.js:8032)
    at beginWork (react-dom.development.js:8221)
    at performUnitOfWork (react-dom.development.js:10224)
    at workLoop (react-dom.development.js:10288)
    at HTMLUnknownElement.callCallback (react-dom.development.js:542)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:581)
    at invokeGuardedCallback (react-dom.development.js:438)

My package.json is this:

"dependencies": {
    "@material-ui/codemod": "^4.5.0",
    "@material-ui/core": "^1.0.0",
    "@material-ui/icons": "^4.5.1",
    "@material-ui/styles": "^4.8.2",
    "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.12.0",
    "react-datepicker": "~0.48.0",
    "react-dom": "^16.2.1",
    "react-feature-toggles": "~3.0.3",
    "react-intl": "~2.4.0",
    "react-loaders": "~3.0.1",
    "react-redux": "^7.1.3",
    "react-router": "~3.2.0",
    "react-tooltip": "~3.10.0",
    "redux": "~3.7.2",
    "redux-form": "~8.1.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"
  },

Has anyone upgrade to material ui v1 from 0.20.2 successfully? And if so which are the exact steps you've followed? Thanks in advance

You have different versions of react and react-dom . The react-dom version you are using (16.2.1) doesn't support hooks. You should change it to be the same as your react version (16.12.0).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM