Skip to main content

DisposableEffect

Function DisposableEffect 

Source
pub fn DisposableEffect<K, F>(keys: K, effect: F)
where K: PartialEq + 'static, F: FnOnce(DisposableEffectScope) -> DisposableEffectResult + 'static,
Expand description

Core runtime helpers commonly used by applications. Runs effect when this call site first enters composition, and again whenever keys no longer equals the value it ran with last time; the previous run’s DisposableEffectScope::on_dispose cleanup, if any, runs first, and also when the call site leaves composition entirely.

keys may be a tuple to depend on more than one value, matching Jetpack Compose’s DisposableEffect(vararg keys).