我在react类中具有以下渲染功能
class ShowDesc extends Component {
constructor(props) {
super(props);
this.dataset = [{
desc: 'This is desc',
}, {
desc: 'This is desc',
}, {
desc: 'This is desc',
}, {
desc: 'This is desc',
}];
}
render() {
return (
<div>
<ul>
{this.dataset.map(item => {
<Desc desc={item.desc} /> // I get below error on this line
})}
</ul>
</div>
);
}
}
我在上面的行中遇到错误
Expected an assignment or function call and instead saw an expression no-unused-expressions
错误是没有提供太多细节,我不确定这段代码究竟在做什么错?