【问题标题】:Allow usage of arrow functions in jsx允许在 jsx 中使用箭头函数
【发布时间】:2016-09-01 15:06:04
【问题描述】:

我正在尝试为 .eslintrc 文件查找规则以防止出现以下错误:JSX props should not use arrow functions

偶然发现:https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md

并尝试将其应用到我的规则中,如下所示:

"rules"   : {
    "jsx-no-bind": [{
    "allowArrowFunctions": true
  }]
}

但似乎没有任何改变

【问题讨论】:

    标签: reactjs lint eslint jsx


    【解决方案1】:

    根据您的链接,您传递给“jsx-no-bind”的数组中的第一个元素应该是<enabled> 值。

    所以这应该有效:

    "rules"   : {
      "jsx-no-bind": [ 
        2, 
        { "allowArrowFunctions": true }
      ]
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-10
      • 2018-10-07
      • 2015-04-14
      • 1970-01-01
      • 2018-11-24
      • 1970-01-01
      • 2017-05-06
      • 2018-11-21
      相关资源
      最近更新 更多