1
shacoTS
1y

Why shall I convert my utility functions into arrow functions?? I really don't see the point.

I think it is way more descriptive to read a line going
"export function buildEntity(){"
Instead of
"export const buildEntity = () => {"

When are you using arrow functions? Do you see any benefits there?

Comments
  • 0
    Who said that you should do that?
  • 4
    Js/Ts?
    Benefit: no .bind(this) required. Behave as expected.

    But honestly, readability is a function of how much you're used to something. Nothing else.

    Readability arguments are bullshit by design, because the readability gauge is always biased.
  • 0
    the decorator pattern works slightly better with lambda assignment.
  • 0
    @lorentz wait, does it mean that you can’t use a js function as a lambda?
  • 0
    It’s preference
  • 0
    This is literally what i was fucking mad about in the beginning but i found out react is a completely different mindset shift (C++ like) than OOP such as angular

    This is why arrow functions in procedural programming (react) is used while in OOP a function syntax is used
  • 0
    @Demolishun that’s what I was thinking too. Other languages do it like that too. But js is, as we all know, special.
  • 1
    i use allow functions whenever the method body is trivial enough to be expressed in one single line without overcomplicating things.
Add Comment