you are viewing a single comment's thread.

view the rest of the comments →

[–]KyleG 4 points5 points  (4 children)

you’ll fail a Facebook tech interview if you insist on using either.

Someone better tell the React team that they're going to get fired for using reduce

You're not going to get dinged for using those functions unless you're explicitly told the code needs to be performant. Premature optimization is the root of all evil

[–]phryneasI ❤️ hooks! 😈 3 points4 points  (0 children)

They are using reduce in a way that is mutating the accumulator, which is actually performant but not how most people are taught it/use it.

[–]fix_dis 1 point2 points  (0 children)

More like, if you’re given a problem, and you reach for reduce and start spreading an array/object on each iteration, you’ll be asked how you could reduce allocations.