UseCallback & UseMemo — A Side Note to the Official Doc

The following can be read as a side reference to the official React Doc:

UseCallback

UseMemo

const memoizedValue = useMemo(() => computeExpensiveValue(a, b), [a, b]);
const List = useMemo(
() =>
listOfItems.map(item => ({
...item,
itemProp1: expensiveFunction(props.first),
itemProp2: anotherPriceyFunction(props.second)
})),
[listOfItems]
)

So what’s the difference between useCallback and useMemo?

useCallback(fn, deps);
useMemo(fn, deps);

Hi :)