【问题标题】:ESlint error when using lodash forEach in jsx在 jsx 中使用 lodash forEach 时出现 ESlint 错误
【发布时间】:2018-08-05 03:39:05
【问题描述】:

我有一个代码:

  renderList = () => {
    const result = this.props.searchResult;
    const liArray = [];
    forEach({ a: 1, b: 2 }, (value, key) => {
      liArray.push(<li>hello</li>);
    });
    return (
      <ul className="text-muted m-0 p-0">{liArray}</ul>
    );
  }

eslint 报错:

[eslint] 不允许不规则的空格。 (无不规则空格)。

这个错误在 forEach 循环中。请帮忙。

【问题讨论】:

    标签: javascript jsx eslint


    【解决方案1】:

    您可能复制/粘贴了一些无效的空白字符。只需删除空格并手动输入即可。

    【讨论】:

      猜你喜欢
      • 2017-06-10
      • 2021-03-19
      • 2018-04-20
      • 1970-01-01
      • 1970-01-01
      • 2018-05-26
      • 2019-12-03
      • 1970-01-01
      • 2016-09-27
      相关资源
      最近更新 更多