-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nextjs + Mui V5 emotion example is still showing className mismatch error #29428
Comments
@amaralc We do not want to advise developers to use both emotion and JSS in their bundle. If you wish to continue to use the |
Thanks for the reply @mnajdova!
I did not configure JSS for SSR since I couldn't find it on v5 docs. I ended up choosing to live without the |
We intentionally don't document this, as it is not used in the core components and the I am closing this. |
@mnajdova I am one of those who faced this struggle. I think it's better to document as long as makeStyles API is living. |
I am having this error in MUI 5 with NextJS 12. |
Looks like this is a struggle for lot of people. I am reopening. We started to work a bit on improving the migration guide in #32740 Will it help if we add as a link in the migration guide an example project for using both @mui/material + @mui/styles? I will start drafting this so that we can link it to people using these packages side by side during the migration or even afterward. Note: @mui/styles is not concurrent mode friendly, so if you are updating React to v18, you will likely need to upgrade to using |
If it is helpful: I'm getting this specific problem only with the Badge component. |
I'm using the same setup and I, too, only had this issue with one or two components. |
Current Behavior 😯
I've followed this example for nextjs + typescript; .
The example works out of the box, however, after adding
@mui/styles
, styling the component withmakeStyles
, adding media queries, and interacting with or refreshing the app, the style breaks and the className did not match from server-side rendering error occurs;Expected Behavior 🤔
Hitting refresh or interacting with the application should not break the styles in any way, nor run into the error.
Steps to Reproduce 🕹
As described in the related issue #27512, in this comment:
@mnajdova, I'm still unsure of how to tackle the issue but it is worth mentioning that the issue is the same, following both,
styled-components
andemotion
examples.Detailed steps to reproduce:
(Terminal) Clone any of the available examples of nextjs + mui + typescript, (emotion or styled-components)
(Terminal) Install dependencies:
(Terminal) Add
@mui/styles
dependency to usemakeStyles
:(/pages/index) Import makeStyles and define
classes
:http://localhost:3000
;responsive
and drag to force the media query responsive font size changes;Context 🔦
I have been trying to setup a Next.js (v12) + TypeScript + MUI v5 application, using
makeStyles
,breakpoints
and other theme related customizations for two days, but ran into many different errors. I tested theemotion
andstyled-components
implementations and both share this specific issue.Your Environment 🌎
`npx @mui/envinfo`
I have tested with Chrome: 95.0.4638.69
The text was updated successfully, but these errors were encountered: