useMemo Hook
useMemo caches a computed value between renders, recomputing only when a dependency changes — used to skip expensive calculations and, just as often, to keep object identity stable for children and dependency arrays. It is a performance hint, not a semantic guarantee: React may discard the cache, so the computation must be pure.
This Concept is waiting for its first lesson!
useMemo caches a computed value between renders, recomputing only when a dependency changes — used to skip expensive calculations and, just as often, to keep object identity stable for children and dependency arrays. It is a performance hint, not a semantic guarantee: React may discard the cache, so the computation must be pure.
Are you a teacher? Sign in to start contributing.
Sign In