pub fn use_memo_with_dependencies<R, D>(
    dependencies: D,
    f: impl FnMut(<D as Dependency>::Out) -> R + 'static
) -> ReadOnlySignal<R>where
    R: PartialEq,
    D: Dependency,
    <D as Dependency>::Out: 'static,
Expand description

Creates a new unsync Selector with some local dependencies. The selector will be run immediately and whenever any signal it reads or any dependencies it tracks changes

Selectors can be used to efficiently compute derived data from signals.

use dioxus::prelude::*;

fn App() -> Element {
    let mut local_state = use_state(|| 0);
    let double = use_memo_with_dependencies(cx, (local_state.get(),), move |(local_state,)| local_state * 2);
    local_state.set(1);

    render! { "{double}" }
}