Skip to main content

use_previous

Function use_previous 

Source
pub fn use_previous<T>() -> Previous<T>
where T: Clone + PartialEq + Debug + 'static,
Expand description

Obtains the previous-value tracker registered against the current hook context slot.

Behaves like HookContext::use_hook: the same Previous is returned on every render at the same hook index, so the captured previous signal survives across renders without losing state.

ยงReturns

  • Previous<T> - The previous-value tracker handle. Returns the factory result directly when no hook context is active (e.g. when called outside a render cycle).