Accepted answer

it's not the arrow function that's causing a problem here. class properties are not part of the es6 specification.

handleupdateinput = (value) => {
  // ...

if you want to be able to transform this code, you'll need to add the class properties babel plugin.

alternatively, this transform is provided as part of babel's stage 2 preset.

using an arrow function with a class property ensures that the method is always invoked with the component as the value for this, meaning that the manual rebinding here is redundant.

this.handleupdateinput = this.handleupdateinput.bind (this);


it is not a problem of arrow function but using it inside class declaration, this code will work in constructor body or any other function body but not in class declaration.

code should look just like that:

    datasource: [
      value + value,
      value + value + value,

using arrow function can be done inside any class method, but not inside class declaration. for example using arrow function in constructor:


   this.somefunc = ()=>{
     //here function code

Related Query

More Query from same tag