jss-styles-hook
v1.0.0
Published
Simple React hook to inject JSS styles into the dom. (like react-jss)
Downloads
4
Readme
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.