Function leptos::create_selector_with_fn

source ·
pub fn create_selector_with_fn<T>(
    source: impl Fn() -> T + 'static,
    f: impl Fn(&T, &T) -> bool + Clone + 'static
) -> Selector<T>
where T: PartialEq + Eq + Clone + Hash + 'static,
Expand description

Creates a conditional signal that only notifies subscribers when a change in the source signal’s value changes whether the given function is true.

You probably don’t need this, but it can be a very useful optimization in certain situations (e.g., “set the class selected if selected() == this_row_index) because it reduces them from O(n) to O(1).