DEV Community

[Comment from a deleted post]
Collapse
 
simoroshka profile image
Anna Simoroshka

Is there a reason why submit function is binded by using arrow syntax and the other functions use .bind?

Collapse
 
sait profile image
Sai gowtham

In arrow functions there is no this keyword. so that this keyword will bound to its outer lexical environment

Checkout my tutorial this keyword execution context in JavaScript

Collapse
 
simoroshka profile image
Anna Simoroshka

Good point! It works the same in react but different under the hood.

Collapse
 
nathansebhastian profile image
Nathan Sebhastian

Hi Anna, not really. It's just to show you can use both to achieve the same result. I was experimenting myself with posts like this ๐Ÿ˜‰