React/React - 잡동사니
@material-ui/core UI를 Class로 구현하기
Velody
2020. 3. 13. 10:43
https://github.com/mui-org/material-ui/issues/15820
@material-ui/styles: Usage in a Class Component? · Issue #15820 · mui-org/material-ui
How does one use the makeStyles API within a class component? The documentation only shows examples for function components. When I try to use this within a class component's render method, I g...
github.com
import { withStyles } from '@material-ui/core/styles';
const useStyles = theme => ({
fab: {
position: 'fixed',
bottom: theme.spacing(2),
right: theme.spacing(2),
},
});
class LoginComponent extends Component {
render() {
const { classes } = this.props;
{/** your UI components... */}
}
}
export default withStyles(useStyles)(LoginComponent)