Skip to main content

use_callback

Memoize a function identity between renders.

Parameters:

  • fn (Callable[P, R]) - A function to memoize.
  • dependencies (Sequence[Any] | None, default: None) - Values the function depends on. If absent, the fn passed on each render is returned as is. If empty, the fn from the first render is kept. Otherwise, it is replaced only when one of the dependencies has changed.

Returns:

  • Callable[P, R] - The memoized function. The same function object is returned on every render until it is replaced.