Are there any differences between the two functions besides this binding?

topic description

is there any difference between the two writing methods that deal with the above methods without binding this?

sources of topics and their own ideas

I saw this way of writing when I used the arrow function of es6. I tried it several times and found that I needed to bind this by myself and I had bindings by myself

related codes

/ / Please paste the code text below (do not replace the code with pictures)

  setComponentType(type) {
    this.setState({type});
  }

  setComponentType = (type) => {
    this.setState({type});
  }

what result do you expect? What is the error message actually seen?

can you introduce some of the differences between the two writing methods?

Dec.01,2021

you want to ask the difference between arrow function and ordinary function, can you take a look at
https://www.cnblogs.com/biubi.

?
Menu