-
Notifications
You must be signed in to change notification settings - Fork 26.7k
-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
Prop className
did not match in development.
#16637
Comments
Hi can I grab this issue? It seems it is some kind of issue that reactjs used to have |
This is still a major pain point (to anyone who doesn't want the "signal to noise ratio" of their console ruined by false warnings, at least). To add a few details, the issue only seems to occur when the styled component uses props inside the styling, eg.
Patching Finally, it's not all of the Styled Components-generated class names that are off: the dev-environment-generated ones remain the same on both server and client. For instance, if I have a styled component called Thus, it very much seems that everything is working together perfectly ... except that Styled Components on the server and on the client are using a different "seed" for generating their (real) class names. |
Hi, I'm having the same issue but I'm using Ant Design not styled component.
I've also been looking for days for a solution. All the threads on this issue seem to be focused on styled-components!! Can any point me to an explanation of why this happens? I have a 6 page multi-step form and everything is working fine as long as I navigate to pages/steps using next/router but I've built in a persistent state using localstorage. I only get this error only when I manually refresh the page and it also causes the page to misrender... for example, with form dropdowns, it renders the select defaultValue text as placeholder text! Setup... next.config.js
.babelrc
package.json
_app.js
Any help will be appreciated, Thanks |
Seems to have the same issue using Material-ui. Error come from |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
I've built a package that composes styled components. If I inline the package and reference it locally within a project (
~lib
), no warnings are shown in development. If I utilize the same code from the npm package, then className mismatch warnings are thrown. This appears to only impact development as production builds don't display any FOUC.To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
cd ~/Desktop && git clone git@github.com:mattcarlotta/sc-prop-mistmatch.git
(or download repo)cd sc-prop-mistmatch/
yarn
yarn dev
Go to Example
buttonGo home
button<PackageComposedButton>Package (warning)</PackageComposedButton>
withinpages/index
and repeat steps 7-9yarn build && yarn start
Expected behavior
No warnings are thrown in development.
System information
Additional context
Not 100% sure if this is a Next issue or a styled-components issue.
Works fine in CSR apps:
https://vyzqr.csb.app/
Throws warnings in SSR apps (may require a few hard refreshes):
https://c3yb5.sse.codesandbox.io/
Cross referenced bug on styled-components: styled-components/styled-components#3238
The text was updated successfully, but these errors were encountered: