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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fix Warning: Prop className did not match #7

Open
wants to merge 1 commit into
base: feat/slider-emotion
Choose a base branch
from

Conversation

mnajdova
Copy link
Owner

This PR tries to solve the warning

react-dom.development.js:88 Warning: Prop `className` did not match. Server: "sc-gKAblj gwnHur MuiSlider-root MuiSlider-colorPrimary" Client: "sc-bdnylx fFZJOT MuiSlider-root MuiSlider-colorPrimary"
    in span (created by styled.span)
    in styled.span (at SliderUnstyled.js:623)
    in ForwardRef(Slider) (at SliderStyled.js:303)
    in ForwardRef(Slider) (at ContinuousSlider.js:33)

If you run it locally do some changes in the code, refresh the page you will start seeing the error after some interaction.\

The changes are based on: https://medium.com/javascript-in-plain-english/ssr-with-next-js-styled-components-and-material-ui-b1e88ac11dfa
I cloned the repo linked there and it works as expected

I tried to make it as close as possible as the project in the example repository. The difference is how babel is used, the example project defined .babelrc, but we have babel.config.js

I also followed the comments on this issues of how to properly add the plugin:
styled-components/babel-plugin-styled-components#78 and tried both names for the plugin: "babel-plugin-styled-components" & "styled-components", but nothing worked so far.

My guess is that somehow the plugin is not correctly loaded, as if I remove the plugin in the example repo that I cloned, the error starts showing again after the code is changed and the page is refreshed.

@mnajdova mnajdova changed the title wip [WIP] Fix Warning: Prop className did not match Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant