Arrow functions were introduced in ES6, and as a React developer, I use them quite frequently. There are some important differences between ordinary functions and arrow functions, which we will explore here.
One of the least-understood areas of arrow functions (or perhaps JavaScript as a whole) it the nature of this
bindings. This mechanism is fundamentally changed when dealing with these functions, so it is an important concept to grasp. Inside arrow functions, this
bindings are lexical instead of dynamic. This is to say that they inherit this
from the parent scope. Let’s look at some examples.
#web-development #programming #javascript #react