Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Material UI v4: add support for React 18 #32685

Closed
2 tasks done
BayoKwendo opened this issue May 8, 2022 · 14 comments
Closed
2 tasks done

Material UI v4: add support for React 18 #32685

BayoKwendo opened this issue May 8, 2022 · 14 comments
Labels
support: question Community support but can be turned into an improvement v4.x

Comments

@BayoKwendo
Copy link

BayoKwendo commented May 8, 2022

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 馃槸

The latest version of @material-ui/core (v4.12.4) does not support React 18.

peer react@"^16.8.0 || ^17.0.0" from @material-ui/core@4.12.4

Expected behavior 馃

support version for react 18

Steps to reproduce 馃暪

Steps:

Context 馃敠

No response

Your environment 馃寧

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
@BayoKwendo BayoKwendo added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label May 8, 2022
@danilo-leal danilo-leal changed the title support for react 18.1.0 [core] Add support for React 18.1.0 May 10, 2022
@danilo-leal danilo-leal added core Infrastructure work going on behind the scenes new feature New feature or request labels May 10, 2022
@oliviertassinari oliviertassinari added out of scope The problem looks valid but we won't fix it (maybe we will revisit it in the future) v4.x and removed new feature New feature or request core Infrastructure work going on behind the scenes status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels May 10, 2022
@oliviertassinari
Copy link
Member

oliviertassinari commented May 10, 2022

React 18 is supported from MUI Core v5.6.0, MUI X v5.9.0 and upward.

@oliviertassinari oliviertassinari added support: question Community support but can be turned into an improvement and removed out of scope The problem looks valid but we won't fix it (maybe we will revisit it in the future) labels May 10, 2022
@oliviertassinari oliviertassinari changed the title [core] Add support for React 18.1.0 Material UI v4: add support for React 18 Aug 30, 2022
@MartinHelvig
Copy link

Any tips on migrating to v5? because in the guide it says to update react first and make sure everything works. But I can't do that because everything does not work after I update react.

@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 23, 2022

@MartinHelvig Please have a look at #35232. Is it clearer?

@MartinHelvig
Copy link

@oliviertassinari yeah thanks, I also noticed it has the @mui/styles in the update package section, which is not supported anymore I think.

@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 23, 2022

@mui/styles is there to allow developers to do a progressive migration from Material UI v4, to Material UI v5.

We want developers to not have to create one big PR, one that would block the development for the rest of their team and one that is more likely to break production.

@MartinHelvig
Copy link

Ah okey, but @mui/styles does not support react 18, so kinda hard anyway.

@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 23, 2022

@MartinHelvig Correct, you would first need to upgrade to React 17, migrate to https://github.com/garronej/tss-react, and then React 18.

But honestly, I don't see the urge to use React 18. I haven't seen strong completing use cases for its new features yet.

@MartinHelvig
Copy link

You might be right about that, just having some other packages dependent on react 18. But I appreciate your comments, helps me alot.

@levrik
Copy link

levrik commented Sep 21, 2023

So far MUI v4 works completely fine on React 18 (without StrictMode). Is there anything I should be aware of? We cannot easily upgrade to MUI v5 but were kind of forced to do the React 18 upgrade now as a lot of other packages started to become incompatible with React 17, for example React Testing Library.

@oliviertassinari
Copy link
Member

@levrik it's mostly ok. There are a few bugs around effect behavior changes, but if it's a legacy project, I think it's OK.

@levrik
Copy link

levrik commented Sep 22, 2023

@oliviertassinari It's our main product which is actively being developed. We're looking into upgrading to MUI v5 but the React upgrade couldn't wait now. We didn't observe any issues within our application so far, so I guess it's okay for now.

@Rabinzon
Copy link

@levrik so react 18 works normally with mui 4?

@levrik
Copy link

levrik commented Apr 15, 2024

@Rabinzon It seemed so, we shipped it to production and received complaints from customers a few hours later. Reverted.
I cannot recommend using MUI 4 with React 18 without very careful QA. We did QA but these things still slipped.

@MartinHelvig
Copy link

The best solution is just to update all packages, use chatGPT to get help on problems u might have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support: question Community support but can be turned into an improvement v4.x
Projects
None yet
Development

No branches or pull requests

6 participants