Function sycamore::rx::create_memo [−][src]
pub fn create_memo<F, Out>(derived: F) -> StateHandle<Out> where
F: FnMut() -> Out + 'static,
Out: 'static,
Expand description
Creates a memoized value from some signals. Also know as “derived stores”.
Example
use sycamore::prelude::*; let state = Signal::new(0); let double = create_memo(cloned!((state) => move || *state.get() * 2)); assert_eq!(*double.get(), 0); state.set(1); assert_eq!(*double.get(), 2);