Skip to main content

use_ref

Preserve a mutable value for the lifetime of the component without causing re-renders.

Parameters:

  • initial_value (RefValueT | Callable[[], RefValueT] | None, default: None) - Optional value or callable returning the value assigned to ref.current.

Returns:

  • MutableRef[RefValueT] - A MutableRef whose .current property can be read and written freely.