I am using React and Material-UI(MUI) in frontend.
In Button Component in MUI, there is className prop,
so I don't know how to apply my style using class in style.css.
I can use id instead of className to apply the style, but I want to know if there's any way to do it.
Please don't tell me to modify to style in useStyles in index.jsx, since I will have other component(DropdownBtn etc) using the same style.
Button/index.jsx
import React, {useState} from 'react';
import Button from '@material-ui/core/Button';
import { makeStyles } from '@material-ui/core/styles';
const useStyles = makeStyles((theme) => ({
button: {
margin: theme.spacing(1),
},
}));
export default function IconLabelButtons(props) {
const classes = useStyles();
const {name} = props;
return (
<Button
variant="contained"
color="primary"
className={classes.button}
>
{name}
</Button>
);
}
App/style.css
.Button {
font-size: 14px;
}