Function untrack
pub fn untrack<T>(f: impl FnOnce() -> T) -> T
Expand description
Run the passed closure inside an untracked dependency scope.
See also ReadSignal::get_untracked
.
ยงExample
let state = create_signal(1);
let double = create_memo(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);