-
-
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
Warning: Prop className
did not match. Server generate classes ID difference than Client classes ID
#28508
Comments
I have tried this as you recommend MyDocument.getInitialProps = async (ctx) => { const originalRenderPage = ctx.renderPage; ctx.renderPage = () => const initialProps = await Document.getInitialProps(ctx); return { But this doesn't help for Mui 5 version |
It's hard to follow what you mean by this. Do you see the error in v5 or v4? If it is happening in v4 it is likely duplicate. See #26876 |
No, the error happens in v5. And your suggestion for v5 https://github.com/mui-org/material-ui/tree/master/examples/nextjs, it doesn't help. Am I managed to explain ?? |
To Arseny, yes it is, it is a dupplicate of bug of this open ticket Here is a sandbox example to see the bug https://codesandbox.io/s/charming-rain-oswex?file=/pages/index.js |
Closing in favor of #27512 |
Material Ui 5 version has problem with SSR
Here is error:
Warning: Prop
className
did not match. Server generate classes ID difference than Client classes IDBut it doesn't help for Mui 5 version.
It helps to Mui 4 version.
But not to Mui 5 version.
Here is example of code
const style = (theme)=>{
return {
example: {
//background: 'yellow' , //this works
background: props => props.bgColor ? props.bgColor: 'yellow' , //this doesn't work
},
};
};
const StyledButton = withStyles(style)(
({classes, bgColor, ...props})=><Button className={classes.example} {...props}/>
);
It works fine if I don't use props like bgColor.
If here is background:'yellow'
But if there is props condition like this
background: (props:BgColorType) => props.bgColor ? props.bgColor: 'yellow' , //this doesn't work
The text was updated successfully, but these errors were encountered: