← All notes

useCallback caches a function definition so memo-wrapped children can skip re-rendering

Answer: useCallback(fn, dependencies) is a React Hook that lets you cache a function definition between re-renders. It matters mainly when you pass the function as a prop to a component wrapped in memo, which lets you skip re-rendering a component when its props are unchanged.

Example

import { memo, useCallback } from 'react';
const ShippingForm = memo(function ShippingForm({ onSubmit }) { /* ... */ });
function ProductPage({ productId, referrer }) {
  const handleSubmit = useCallback((orderDetails) => {
    post('/product/' + productId + '/buy', { referrer, orderDetails });
  }, [productId, referrer]);
  return <ShippingForm onSubmit={handleSubmit} />;
}

useCallback versus useMemo

The difference is in what they let you cache: useMemo caches the result of calling your function, while useCallback caches the function itself.

When it is worth it

useCallback is only valuable in a few cases: passing the function as a prop to a component wrapped in memo, or the function is used as a dependency of another Hook. If most interactions are granular, like moving shapes in a drawing editor, memoization can be very helpful.

How memo compares props

memo returns a new React component. By default, React will compare each prop with Object.is. You can pass an optional arePropsEqual function, but usually you will not specify it.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: React docs (reference), useCallback; reactjs/react.dev (GitHub), memo (source page). CC-BY-4.0 (https://raw.githubusercontent.com/reactjs/react.dev/main/LICENSE-DOCS.md). Copyright Meta Platforms, Inc. and affiliates. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: React docs (reference), useCallback; reactjs/react.dev (GitHub), memo (source page). CC-BY-4.0 (https://raw.githubusercontent.com/reactjs/react.dev/main/LICENSE-DOCS.md). Copyright Meta Platforms, Inc. and affiliates.

Cite this

Permanent ID: iil:note:ayrqqmkb

iinventedlight. 2026. "useCallback caches a function definition so memo-wrapped children can skip re-rendering." iinventedlight Library, iil:note:ayrqqmkb, version of 2026-11-18. https://iinventedlight.com/library/notes/react-usecallback/. License: CC-BY-4.0.

@misc{iil_note_ayrqqmkb,
  author = {{iinventedlight}},
  title = {{useCallback caches a function definition so memo-wrapped children can skip re-rendering}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-18},
  url = {https://iinventedlight.com/library/notes/react-usecallback/},
  note = {Permanent ID iil:note:ayrqqmkb. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/react-usecallback.md.