materila-ui usestyle different style based on prop code example
Example: pass props to style material ui
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';
import {Theme} from '@material-ui/core';
export interface StyleProps {
height: number;
}
const useStyles = makeStyles(theme => ({
root: {
background: 'green',
height: ({height}) => height,
},
}));
export default function Hook() {
const props = {
height: 48
}
const classes = useStyles(props);
return ;
}