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

revskill10 picture revskill10  路  3Comments

ericraffin picture ericraffin  路  3Comments

reflog picture reflog  路  3Comments

rbozan picture rbozan  路  3Comments

finaiized picture finaiized  路  3Comments