The Overuse of useCallback and useMemo in React
By
0xedb
10mo ago· 7 min readenOpinion
100/100
Golden Brown
Bagelometer↗
Baker's choice. Dense with flavour, light on filler.
Score100TypeopinionSentimentneutral
Summary
The article critiques the overuse of `useCallback` and `useMemo` in React, arguing that these memoization techniques are often applied unnecessarily. The author highlights that memoization should only be used for performance optimization when something is genuinely slow, rather than as a default practice. The piece aims to educate developers on when and why to avoid unnecessary memoization.
Key quotes
· 3 pulledWhy memoize? There's usually only two reasons to create a memoized version of a function with useCallback or a value with useMemo: Performance optimization.
Something is slow, and slow is usually bad. Ideally, we'd make it faster, but we can't always do that. Instead, we can try to do that slow thing less often.
I thought I'd written enough about memoization by now, but I feel there is one pattern I'm seeing a lot lately that makes me think otherwise.
Why most memoization is downright useless...
