Function leptos_reactive::create_selector_with_fn
source · pub fn create_selector_with_fn<T>(
cx: Scope,
source: impl Fn() -> T + Clone + 'static,
f: impl Fn(&T, &T) -> bool + Clone + 'static
) -> impl Fn(T) -> bool + Clonewhere
T: PartialEq + Eq + Debug + 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)
.