We are setting up Server Side Rendering for an existing project using React-MUI. We have gotten everything working except for styling. None of our CSS will load for the server side render. Any inline CSS works fine, but any of the sheets defined at the start of the file, and bound with export default withStyles(styles)(Page) do not work.
Our styling is defined as follows:
const styles = (theme) => ({
root{
//some CSS Here ...
}...
});
Which is then bound to pour props with
export default typeof window !== 'undefined'
? withRouter(connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)(Home)))
: withStyles(styles)(Home);
and accessed with
const {classes} = this.props;
//then in render
<div className={classes.root}>...</div>
None of the classes.someClassName CSS works in server side rendering, but the second we render in browser it functions normally. Current ideas are to try using a <ThemeProvider/> wrapper from MUI but any advice is appreciated.
Thanks!