Am able to use withTheme in my React 16 application
When using withTheme from [email protected] with React 16, React gives the following warning, which is fatal to the execution of my app.
Warning: Functions are not valid as a React child. This may happen if you return a Component instead of
Here is an example of how I am using withTheme:
const MyComponent = props => {
// use props.theme.palette.text.primary
};
export default withTheme(MyComponent);
Issue did not exist when using withTheme with React 15. Issue occurs post-upgrade of React.
| Tech | Version |
|--------------|---------|
| Material-UI | 1.0.0-beta.16 |
| React | [email protected], [email protected] |
| browser | Chrome Version 61.0.3163.100 |
The signature changed:
-export default withTheme(MyComponent);
+export default withTheme()(MyComponent);
Thank you. Must have been brought in with my npm update. Sorry I missed it.
Most helpful comment
The signature changed: