React·100 questions

What is useMemo and when is it useful?

Answer
useMemo caches the result of a computation.
Needed for expensive calculations or stable references.
Does not replace rendering optimization everywhere.
Watch deps, otherwise it will be stale.
Often useful before passing to memo/effects.
Was this answer helpful?

More questions in this topic

Related questions from other topics