DEV Community

Discussion on: Using arrow functions in object methods

link2twenty profile image
Andrew Bone

An arrow function is, basically, a replacement for the function keyword. There is a bit more nuance to it but that's the basic rule.

If you weren't using function before you don't need to use it now.

Thread Thread
lisaveras profile image
LV 🏳️‍🌈

The primary use of an arrow function is to bind the context so that "this" becomes lexical and not determined at run time. This is super helpful when writing React!

Though I will admit that arrow functions are quite snazzy looking and using it just because it looks better is totally valid.