【发布时间】:2020-02-14 08:14:47
【问题描述】:
我正在学习“如何设置材质 UI 组件的样式”。在本教程中,它为您提供了以下 Hook Api 代码:
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';
const useStyles = makeStyles({
root: {
background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)',
border: 0,
borderRadius: 3,
boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .3)',
color: 'white',
height: 48,
padding: '0 30px',
},
});
export default function Hook() {
const classes = useStyles();
return <Button className={classes.root}>Hook</Button>;
}
据我了解,我有一个具有这种风格道具的新按钮。我的问题是如何在渲染中使用这个新按钮?
class CreateUserPage extends React.Component {
render() {
return (
// How to use it???
);
}
}
【问题讨论】:
标签: javascript reactjs material-ui