DEV Community

Discussion on: What is "this"? Why you should avoid arrow functions on Vue methods

Collapse
 
ivanpepelko profile image
Ivan Pepelko

Saying that arrow function "binds to the parent scope" is just plain wrong and misleading. If you refer to MDN page, you will immediately see that arrow functions don't bind to ANYTHING ("Does not have its own bindings to this or super, and should not be used as methods") - which also tells you specifically not to use them as methods.
Understanding "this" is very important for writing proper JS, but I don't see the point of this article while knowing the exact same thing is stated in the doc (with less confusing wording).

developer.mozilla.org/en-US/docs/W...

Collapse
 
js_bits_bill profile image
JS Bits Bill

Not wrong or misleading at all. As stated: "The really important takeaway here is that arrow functions do not have their own this."

On MDN
"because Arrow functions establish "this" based on the scope the Arrow function is defined within."
developer.mozilla.org/en-US/docs/W...