Skip to main content

watch

Function watch 

Source
pub fn watch<S>(
    source: impl Fn() -> S + 'static,
    cb: impl Fn(&S, Option<&S>) + 'static,
)
where S: Clone + 'static,
Expand description

Derive-state without effect-write loops (§4.2): source is tracked; cb runs untracked with (new, old). Does not fire for the initial value: a “load whatever is selected” reaction has to run once by hand first, or use bind, which applies the initial value and then every change.

Day API ↩ Guides· daybrite.dev