期望一个赋值或函数调用,而是看到一个表达式no-unused-expressions

时间:2018-11-19 19:02:14

标签: javascript reactjs

我在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

错误是没有提供太多细节,我不确定这段代码究竟在做什么错?

0 个答案:

没有答案