我的 HOC:
const withPaper = Component => props => (
<Paper>
<Component {...props} />
</Paper>
);
export default withPaper;
我想使用以下方式设置“Paper”组件的样式withStyles()
:
const styles = theme => ({
root: {
backgroundColor: 'green'
}
});
const withPaper = ?? => ?? => (
<Paper className={classes.root}>
<Component {...props} />
</Paper>
);
export default withStyles(styles)(withPaper);
在这种情况下,我如何注入类道具?我的简单想法Component => ({classes, ...props}) =>
记录错误。
TypeError:无法将类作为函数调用