React
React useMemo HookReact useMemo Hook
The useMemo Hook caches expensive calculations to improve performance.
Read Time
5 min readDifficulty
BeginnerLast Updated
Jun 15, 2026Version
v1.0.0Introduction
Sometimes a component runs a slow, heavy math calculation every time it renders. The `useMemo` Hook fixes this by remembering the answer from the last render. It only recalculates the math if the input data actually changes.
Example
Example
Key Points
- "Memoization" means caching a result.
- It stops slow functions from running needlessly.
- The first argument is the calculation function.
- The second argument is the dependency array.