Skip to main content

use_memo

Memoize a computed value between renders.

Parameters:

  • calculate_value (Callable[[], MemoValueT]) - A function that computes the value to be memoized.
  • dependencies (Sequence[Any] | None, default: None) - Values the computation depends on. If absent, the value is recomputed on every render. If empty, it is computed only on the first render. Otherwise, it is recomputed only when one of the dependencies has changed. A list or dict field of an observable counts as changed when it is changed in place, such as by items.append(x).

Returns:

  • MemoValueT - The memoized value. The same object is returned on every render until the value is recomputed.