-
Notifications
You must be signed in to change notification settings - Fork 477
Next-Expo app with Material-UI producing "Warning: Prop className
did not match."
#1605
Comments
hello! this is a next.js/styled-components issue as you pointed out. the solution does seem to be to install the styled-components babel plugin. I'm not sure why that would take forever to install, maybe an intermittent issue with your internet connection or the npm registry? |
It's really very very slow, these are some of the installation loading processes that I'm seeing after
|
@brentvatne I've successfully installed
@AndysonDK My "next.config.js" structure is different because it's generated by
|
Hmmmm, another solution might be to wrap all the components that throw warnings inside of a NoSsr component maybe: This is probably not a good option for us people that want to server-side render everything though :( |
@AndysonDK I don't know, but Material-UI seems rendering its styles on the client dynamically. Did you know why the client-side styling is happening, I guess because of |
I'm not sure, but I've heard that because the Box component is dynamic it will do some client-side processing or something like that. But I haven't noticed any of my styles being rendered client-side though. I do use StyleProvider: So my styles are in fact rendered client-side (injected at the top of the I'm making sure to remove the server-side rendered CSS so there is no duplicate since it's also being rendered client-side: I don't think Here is the plan for the new material ui version if you haven't already seen it: |
|
Using Material-UI or specifically implementing https://material-ui.com/components/app-bar/#back-to-top on a web project with
@expo/next-adapter
and refreshing the web browser resulting to have a console "Warning: Prop `className` did not match."Environment
Expo CLI 3.13.1 environment info:
System:
OS: Windows 10
Binaries:
Yarn: 1.16.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.13.7 - C:\Program Files\nodejs\npm.CMD
Watchman: 4.9.4 - C:\Users\5ervant\AppData\Local\watchman\watchman.EXE
IDEs:
Android Studio: Version 3.5.0.0 AI-191.8026.42.35.6010548
Reproducible Demo
This is my wrapper
<Layout>
component implementing this Material-UI App Bar: https://material-ui.com/components/app-bar/#back-to-topI tried this solution vercel/next.js#7322 (comment) vercel/next.js#7423 (comment) by
npm install --save-dev babel-plugin-styled-components
butbabel-plugin-styled-components
takes forever to install.Now I'm doing
npm uninstall --save-dev babel-plugin-styled-components
but uninstalling it also seems forever. I just cancel then runyarn
to check dependencies.My Observations
Having
<Box my={2}>{props.children}</Box>
is throwing a 'Warning: Prop `className` did not match. Server: "MuiBox-root MuiBox-root-136" Client: "MuiBox-root MuiBox-root-90"'Having
className={classes.root}
is throwing a 'Warning: Prop `className` did not match. Server: "makeStyles-root-143" Client: "makeStyles-root-89"'What do we need to do to get rid of those warnings?
Current Solution
Not to refresh your developing Next-Expo web page and just let it auto-update after editing your project source code.
The text was updated successfully, but these errors were encountered: