我是使用ES6类和React的新手,以前我一直将我的方法绑定(bind)到当前对象(在第一个示例中显示),但是ES6是否允许我将类函数永久绑定(bind)到带有箭头的类实例?(在作为回调函数传递时很有用。)当我尝试像使用CoffeeScript一样使用它们时出现错误:classSomeClassextendsReact.Component{//Insteadofthisconstructor(){this.handleInputChange=this.handleInputChange.bind(this)}//CanIsomehowdothis?Amijustgettingthesy
我是使用ES6类和React的新手,以前我一直将我的方法绑定(bind)到当前对象(在第一个示例中显示),但是ES6是否允许我将类函数永久绑定(bind)到带有箭头的类实例?(在作为回调函数传递时很有用。)当我尝试像使用CoffeeScript一样使用它们时出现错误:classSomeClassextendsReact.Component{//Insteadofthisconstructor(){this.handleInputChange=this.handleInputChange.bind(this)}//CanIsomehowdothis?Amijustgettingthesy