SSR classNames not matching when using Style Object
See original GitHub issueHello,
I’m integrating react-select to my SSR implementation, and currently I’m having issues with classNames not matching:
Warning: Prop className
did not match. Server: “css-1u7qna3” Client: “css-6xc8cw”
My Select declaration is as follows:
<Select
instanceId={this.props.elementConfig.name}
value={selectedOption}
onChange={this.handleChange}
options={options}
styles={customStyles}
className='Occupation'
classNamePrefixunion='Option--'
/>
The problem seems to happen when I try to use the styling object, as per the documentation below:
https://react-select.com/styles
I was wondering if someone else has experienced this issue and would care to help.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:17
- Comments:12
Top Results From Across the Web
Warning: Prop `className` did not match. when using styled ...
That error is showing you the class that is being created by your styled-components library on the server and how it is different...
Read more >Warning: Prop className did not match. #7322 - GitHub
It appears to be an issue that backend generates styled component but client doesn't get it/doesn't use it and instead of using server...
Read more >Warning: Prop `className` did not match ~ Material UI css ...
I ended up just using the ServerStyleSheet fix to try to make it agreeable with Material UI's ServerStyleSheets object, and ended up with...
Read more >Tooling - styled-components
If you do not use this plugin and try to server-side render ... "ssr": false ... enable you to store your styled components...
Read more >Server Side Rendering - Emotion
The default approach works with streaming and requires no additional ... output will insert a <style> tag above each element with styles for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The instanceId doesn’t fix it for me.
Without instanceId i’m getting the error:
Warning: Prop
iddid not match. Server: "react-select-24-input" Client: "react-select-2-input"
In another issue i learned that i have to set the instanceId. With id instanceId the prop id warning is away but now i’m getting the className prop warning.
Is there something i’m missing? thanks
I also was having this issue. Giving it an
instanceId
seemed to fix it for me.