Function sycamore_reactive::untrack[][src]

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

Run the passed closure inside an untracked dependency scope.

This does NOT create a new ReactiveScope.

See also [StateHandle::get_untracked()].

Example

use sycamore_reactive::*;

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);