I shared my problem on this GitHub issue too: https://github.com/mui-org/material-ui/issues/25312
Currently, I'm working with the Gatsby example provided in Material UI v5: https://github.com/mui-org/material-ui/tree/next/examples/gatsby
After implementing their example, I included the following code snippet:
import { makeStyles } from '@material-ui/core';
const useStyles = makeStyles({
typographyHeader: {
fontWeight: 'bold',
fontSize: () => 30,
color: '#292929',
},
});
<Typography classes={{ root: classes.typographyHeader }} align="center">
Gatsby v5-alpha example
</Typography>
When running npm run develop
in a browser with JavaScript enabled, I get this output:
https://i.sstatic.net/2ChIM.png
However, when running npm run develop
with JavaScript disabled (resulting in SSR), I see this instead:
https://i.sstatic.net/GVyMV.png
In the second screenshot, you can observe that my custom styles are being overridden by Material UI's default styles. The same issue occurs even when utilizing withStyles.
Can someone guide me on the correct configuration to prevent Material UI v5 from overriding my custom styles?