I rarely memoize in React
I rarely memoize in React.
Instead I:
1. Keep state as local as possible, to keep renders local.
2. Strategically decompose components to keep frequent renders small.
3. Pass children/slots to avoid needless renders in child components.
Memoization is a last resort.
Oh, one more:
4. Keep datasets reasonable. If the app displays 1000s of elements, we should offer filtering, sorting, search, tagging, and pagination.
Humans can't absorb 1000s of elements at once.
So, make it easy to find a needle in the haystack.
Summary: If rendering is slow, I look for the root cause. Usually moving state, decomposing components, or throttling updates does the trick.
If you're unclear what #3 looks like, see this excellent post by @dan_abramov
https://overreacted.io/before-you-memo/