Skip to content
React·Advanced·Conceptual·1 min read

Why doesn't useMemo guarantee a value is never recalculated?

Short interview answer

React may choose to discard cached memoization results in some circumstances, such as under memory pressure, so useMemo should be treated as a performance hint rather than a semantic guarantee of calling the function only once per dependency change.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to React performance optimization

Related questions