const memoizedValue = useMemo(() => {
// factory function
}, [obj]);
Imagine obj has several nested props.
In this example with useMemo hook:
- Will React recompute the value given by the factory function if the reference to
objchanges?
or
- It applies a deep/shallow compare on
objand then recompute the value if some prop have changed, regardless of its reference?