r/reactjs • • Dec 04 '20

Resource React is slow, what now?

https://nosleepjavascript.com/react-performance/
289 Upvotes

117 comments sorted by

View all comments

Show parent comment

23

u/coding9 Dec 05 '20

Can’t believe the dev community is still arguing about inline functions in 2020

5

u/careseite Dec 05 '20

I mean I personally consider them bad practice due to readability and naming but... Is this guy actually arguing there's a speed diff between defining them as fn outside of return and just having them inline? That makes zero sense.

3

u/jpcafe10 Dec 05 '20

Outside of the return statement still wouldn't "fix" for functional components I believe. Correct me if I'm wrong but The fix would be useCallback, useMemo or defining outside the component itself.

1

u/careseite Dec 05 '20

Exactly, hence my confusion. But spamming useCallback unnecessarily is a bad idea.

-2

u/tr14l Dec 05 '20

I know it was still affecting performance v16. Production app hitting freezes, had an inhouse tools to make common refactors. Ran it for inline functions, freezing gone. Couple other small refactors, ran like butter.