1.0.0 • Published 5 years ago

jss-styles-hook v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

jss-styles-hook

Recreation of react-jss but using React's hooks API.

So, instead of:

const styles = {
  // ...
}

const Button = function({classes, children}) {
  return <button className={classes.myButton}>
    <span className={classes.myLabel}>{children}</span>
  </button>;
}

const StyledButton = withStyles(styles)(Button)

you can use:

const styles = () => ({
  // ...
})

const StyledButton = function({children}) {
  const classes = useStyles(styles);

  return <button className={classes.myButton}>
    <span className={classes.myLabel}>{children}</span>
  </button>;
}

In the future I want to make it more like @material-ui styling system, with themes and other features. But hopefully by then @material-ui/styles will be stable enough to actually use.