React.memo

A React function that wraps a component so it skips re-rendering when its props are shallowly equal to the previous ones.

In more detail

It only helps if the props really stay the same: an inline object or function prop is new every render and defeats it, so pair it with useMemo and useCallback. A memoized component still re-renders when its own state or a context it reads changes.

Example

const Child = memo(function Child({ onRun }) { ... });

Related terms

Taught in

References