DEV Community

Cover image for Making React less stupid: automatic `useMemo` and `useCallback` insertions are coming!
Domi
Domi

Posted on

2 1

Making React less stupid: automatic `useMemo` and `useCallback` insertions are coming!

Is it just me, or is the recently announced optimizing compiler an absolute treat that removes one of the most annoying aspects of modern React development? It finally takes care of the pesky old question of whether or not to bother adding useMemo or useCallback (and it comes with several more goodies).

The ups and downs of memoizing everything have been discussed again and again, including on r/reactjs, more recently, in this thread. That thread also includes several important comments by u/acemarke on this matter, where amongst others, he shares his insightful blog post on "memoizing everything".

Of course, there are trade-offs to be made, but I love the fact that this difficult, and often just downright annoying decision making process of whether or not to add the call can finally be deferred to an automatic process. I for one have always been a big fan of the two, even at the cost of performance in some cases, just for the crucially important (and criminally under-documented) property of upholding referential identity.

I can't wait!

Top comments (0)

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay