【发布时间】:2021-11-22 03:54:51
【问题描述】:
我想使用像here 中描述的单行 if 语句返回一个类。在我的方法中,我使用的是 Material-UI 并想设置一个类。
所以我想用这个方法if(condition) expression
<Typography className={ if (typeof title === 'string') classes.title } >{ title }</Typography>
我收到以下错误:解析错误:预期表达式
我在这里做错了什么?
【问题讨论】:
标签: javascript if-statement material-ui shorthand