shallow comparison
Comparing two objects one property at a time with Object.is, without looking inside nested objects.
In more detail
React.memo uses it on props: the component re-renders only if some prop is not Object.is equal to its previous value. It is fast but cannot tell that a newly created object has the same contents as the old one.
Related terms
- React.memo — A React function that wraps a component so it skips re-rendering when its props are shallowly equal to the previous ones.
- Object.is — The JavaScript function that tells whether two values are the same value, comparing objects by identity.
- reference equality — Comparing two references to see whether they point to the very same object, rather than to objects with equal contents.
Taught in
- React.memo, useMemo, And useCallback: Optimization Costs — React 19 & Modern Component Architecture