📝Do not overuse React.useCallback


Wrapping every callback function in useCallback isn’t worth it. The cost of optimization is likely higher than updating the child.

Pass an inline callback and an array of dependencies. useCallback will return a memoized version of the callback that only changes if one of the dependencies has changed. This is useful when passing callbacks to optimized child components that rely on reference equality to prevent unnecessary renders (e.g. shouldComponentUpdate).Hooks API Reference > useCallback – React

Two legible use cases for useCallback are:


See also: