Memoization is an optimization technique where the result of a function call is cached, and is then returned when the same input occurs again. The useMemo Hook allows us to compute a value and memoize it. We can use it as follows:
import { useMemo } from 'react'
const memoizedValue = useMemo(() => computeExpensiveValue(a, b), [a, b])
The useMemo Hook is useful for optimization when we want to avoid re-executing expensive operations.