Function maple_core::reactive::untrack[][src]

pub fn untrack<T>(f: impl FnOnce() -> T) -> T

Run the passed closure inside an untracked scope.

See also StateHandle::get_untracked().

Example

use maple_core::prelude::*;

let state = Signal::new(1);

let double = create_memo({
    let state = state.clone();
    move || untrack(|| *state.get() * 2)
});

assert_eq!(*double.get(), 2);

state.set(2);
// double value should still be old value because state was untracked
assert_eq!(*double.get(), 2);