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

Creates a new Selector that may be sync 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::*;
use dioxus_signals::*;

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

    render! { "{double}" }
}