react 给对象方法自动绑定this

Combining two ES6+ features – arrow functions and property initializers

使用babel插件

npm install babel-plugin-transform-class-properties --save

// .babelrc
{
  "plugins": ["transform-class-properties"]
}

你可能感兴趣的:(react 给对象方法自动绑定this)