This.handleClick = this.handleClick.bind (this) do not understand

this.handleClick = this.handleClick.bind (this)

Mar.16,2021

The this point of the

function is determined when it enters the execution context, and it is not statically bound.

  < / div > 

  • or use the arrow function to define the method. Because the arrow function is not bound to this, you will look up the this and you will find the component instance to use
  • or use es7's :: (I haven't used it, so I won't say it)
  • in short, it is recommended that you re-learn bind, call, apply , react this and other knowledge

    Menu