Duration
2 min
Access
Free
Transcript
Available

If you have a React component that is computing a value that is expensive to compute, then you can cache that value with the useMemo hook, so that it's only re-computed when one of its dependencies change.

In this lesson, we'll use useMemo to memoize (cache) a label that is computed when the user presses a button - but we'll prevent it from being computed when the user updates other parts of the state (an input text value in this case).