makeStyles -> useStyles
makeStyles()
makeStyles()const useStyles = makeStyles<{ color: string; }>()(
(_theme, { color }) => ({
"root": {
"backgroundColor": color
}
})
);
//...
const { classes } = useStyles({ "color": "grey" });const useStyles = makeStyles()({
//If you don't need neither the theme nor any state or
//props to describe your component style you can pass-in
//an object instead of a callback.
"root": {
"backgroundColor": "pink"
}
});
//...
const { classes } = useStyles();Naming the stylesheets (useful for debugging and theme style overrides)
useStyles()
useStyles()Last updated
Was this helpful?