for class component you can use withStyles
wrapper.
import React, { Component } from "react";
import { withStyles } from "@material-ui/core/styles";
class App extends Component {
render() {
const { classes } = this.props;
return <div className={classes.styledLine}>Styling using withStyles</div>;
}
}
const useStyles = (theme) => ({
styledLine: {
color: "red"
}
});
export default withStyles(useStyles)(App);
Working demo:-
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…