DEV Community

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

Posted on

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)