useMemo
useMemo is a React Hook that caches a calculated value between renders and recomputes it when specified dependencies change.
React in Depth
useMemo is a React hook that caches the result of a calculation between renders until its dependencies change.
- How it is used
- Uses useMemo to avoid repeated calculations and preserve prop identity during React rendering.
- How deep it goes
- Explains the calculation-and-dependency contract through implementations, but does not detail React’s cache internals.
- Examples
- Demonstrates employee filtering, cached to-do JSX, and a stable array prop for a memoized child.
- What you can do after
- Apply it via React’s useMemo hook to cache derived values or stabilize props, while weighing measured benefit against overhead.
React Quickly, Second Edition
useMemo is a React Hook that memoizes a calculated value and reuses it across renders until its dependencies change.
- How it is used
- Avoids recalculating values on repeated renders when their dependencies have not changed.
- How deep it goes
- Explains dependency-triggered recalculation and illustrates an empty dependency array with a generated ID.
- Examples
- Uses an expensive password hash and a gallery image's generated ID to demonstrate memoized values.
- What you can do after
- Apply useMemo to reuse a generated ID across renders or recalculate a value only when dependencies change.
React Hooks in Action: With Suspense and Concurrent Mode
useMemo is a React Hook that memoizes a calculated value and recomputes it when specified dependencies change.
- How it is used
- Uses memoization to reduce unnecessary expensive calculations during React rendering and protect interactive UI responsiveness.
- How deep it goes
- Explains calculation functions, dependency comparison, cache caveats, and a bookings-grid implementation, while stopping short of React internals.
- Examples
- Demonstrates expensive anagram generation and memoized booking-grid generation based on a selected bookable and week.
- What you can do after
- Apply useMemo to wrap an expensive calculation and regenerate it when named dependencies change.
Read how React Hooks in Action: With Suspense and Concurrent Mode explains useMemo →
Related concepts
- memoizationuses · Memoization is an optimization technique that stores computation results with their inputs so equivalent later evaluations can reuse them without recomputation.
- React hookkind of · A React Hook is a function-based API that enables function components to access state, effects, context, and other React capabilities.
- dependency arrayconfigured by · A dependency array is an array passed to a React effect or memoization Hook that specifies values whose changes trigger recomputation or rerunning.
- componentused by · A software component is a modular part of a larger system that provides related functionality and interacts with other parts through defined boundaries or interfaces.
- useCallbackequivalent to · useCallback is a React Hook that memoizes a function reference and reuses it across renders until its specified dependencies change.
- JSXuses · JSX is a JavaScript syntax extension for expressing user-interface elements with XML-like or HTML-like markup that is transformed into JavaScript.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


