nathanmarks / jss-theme-reactor

NOT MAINTAINED Powerful theming layer for use with the jss CSS in JS library
MIT License
64 stars 6 forks source link

AppThemeProvider.render(): A valid React element (or null) must be returned. #19

Open Extra-lightwill opened 7 years ago

Extra-lightwill commented 7 years ago

I've been looking at the 'next' branch in MUI (https://github.com/callemall/material-ui/tree/next) and would like to use a similar pattern to implement theming in my own application.

I've adapted the MUI next branch code in styles folder (https://github.com/callemall/material-ui/tree/next/src/styles) to suit the needs of my own application but pretty much stuck to the same core structure.

However, I'm running into errors and I'm wondering if you could help me out or at least point me in the right direction for a solution and maybe give an explanation of why it is occurring.

The error (which i assume is something to do with this.props.children from my ThemeProvider component but I'm not exactly sure what):

Server error: renderOnServer render function failed Invariant Violation: AppThemeProvider.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.

2nd error Server error: renderOnServer render function failed TypeError: document.querySelector is not a function - this is a server-side rendering issue because node can't perform DOM manipulations but I'm unsure how to get around it

Additional info: My application is Isomorphic

Extra-lightwill commented 7 years ago

I realise that the server-side rendering section under 'Usage' hasn't yet been completed and I also realise that this is a relatively new library.

My question is when will compatibility with Isomorphic applications/ SSR instructions be added?

I haven't managed to find a theming solution which works as gracefully as this one so I'd love to use it, preferably sooner rather than later!