I am trying to understand when useMemo is actually beneficial.
For example, I understand that it can avoid repeating an expensive calculation
const result = useMemo(() => expensiveCalculation(data), [data])
How do I find out whether a calculation is expensive enough to justify useMemo? Also, does using useMemo unnecessarily have any performance cost?