Skip to content

Conversation

@treetips
Copy link
Owner

material-ui v4 support StylesHook without withStyles(HOC).

This repository migrate withStyles to StylesHook(makeStyles).

Wrap makeStyles

const styles = (theme: Theme) => createStyles({
    root: {},
  })

const useStyles = makeStyles((theme: Theme) => createStyles({
    root: {},
  }))

Remove extends

interface IProps extends WithStyles<typeof styles> {
  children: React.ReactNode
}

interface IProps {
  children: React.ReactNode
}

Add useStyles

const { classes, children } = props

const { children } = props
const classes = useStyles(props)

Remove HOC based withStyles

const XxxContainerComponent = (props: IProps) => {
  // snip
}
export const XxxContainer = withStyles(styles)(
  XxxContainerComponent
)

export const XxxContainer = function(props: IProps) {
  // snip
}

@treetips treetips merged commit 9432af2 into master Jun 15, 2019
@treetips treetips deleted the feature/support_makestyles branch June 15, 2019 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants