`useMemo` is a React Hook that memoizes a value, preventing its recalculation on every render unless its dependencies change. This optimizes performance by avoiding expensive computations when the inputs to those computations remain the same.
The function wrapped in useMemo runs during rendering so it only works for pure calculations. It's basically a cache across renders.
---
https://react.dev/learn/you-might-not-need-an-effect