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!

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

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

Okay