React, what is the difference between binding and arrow function

I’ve seen in curriculum, that you can use the following syntax when declaring a method:

this.myFunction = this.myFunction .bind(this)
//then you declare the function below
myFunction(){
     return "hello world!"
}

but I’ve seen another method when you don’t bind the function like so:

myFunction = () => {
   return "hello world!"
}

This is true. Those are two ways to write a function. What exactly is your question?

I am talking about react,

Does this help?
Using Arrow Functions to avoid binding this in React

2 Likes

Thanks mate for sharing