Struct sycamore::prelude::StateHandle [−][src]
pub struct StateHandle<T: 'static>(_);
Expand description
A readonly Signal
.
Returned by functions that provide a handle to access state.
Use Signal::handle
or Signal::into_handle
to retrieve a handle from a Signal
.
Implementations
Get the current value of the state. When called inside a reactive scope, calling this will add itself to the scope’s dependencies.
Get the current value of the state, without tracking this as a dependency if inside a reactive context.
Example
use sycamore::prelude::*; let state = Signal::new(1); let double = create_memo({ let state = state.clone(); move || *state.get_untracked() * 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);
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for StateHandle<T>
impl<T> !Send for StateHandle<T>
impl<T> !Sync for StateHandle<T>
impl<T> Unpin for StateHandle<T>
impl<T> !UnwindSafe for StateHandle<T>
Blanket Implementations
Mutably borrows from an owned value. Read more