【发布时间】:2018-11-20 13:57:28
【问题描述】:
我的 HOC:
const withPaper = Component => props => (
<Paper>
<Component {...props} />
</Paper>
);
export default withPaper;
我想使用 withStyles() 设置“Paper”组件的样式:
const styles = theme => ({
root: {
backgroundColor: 'green'
}
});
const withPaper = ?? => ?? => (
<Paper className={classes.root}>
<Component {...props} />
</Paper>
);
export default withStyles(styles)(withPaper);
在这种情况下如何注入类道具?
我的简单想法Component => ({classes, ...props}) => 记录错误。
TypeError:无法将类作为函数调用
【问题讨论】:
标签: material-ui jss