Material-ui: I don't understand how to combine withStyles and withTheme

Created on 1 Nov 2017  路  1Comment  路  Source: mui-org/material-ui

I tried the following withTheme(withStyles(styles)(Modal)) but it doesn't work and gives me a warning

Functions are not valid as a React child. This may happen if you return a Component instead of from render. Or maybe you meant to call this function rather than return it.

question

Most helpful comment

@ilyador You have different options:

export default withTheme()(withStyles(styles)(Modal));

```js
export default withStyles(styles, { withTheme: true })(Modal);

```js
import { compose }聽from 'recompose';

export default compose(
  withTheme(),
  withStyles(styles)
)(Modal);

>All comments

@ilyador You have different options:

export default withTheme()(withStyles(styles)(Modal));

```js
export default withStyles(styles, { withTheme: true })(Modal);

```js
import { compose }聽from 'recompose';

export default compose(
  withTheme(),
  withStyles(styles)
)(Modal);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

chris-hinds picture chris-hinds  路  3Comments

anthony-dandrea picture anthony-dandrea  路  3Comments

ghost picture ghost  路  3Comments

reflog picture reflog  路  3Comments

sys13 picture sys13  路  3Comments