pub fn keyed<K, P>(
key: impl Fn() -> Option<K> + 'static,
build: impl Fn(&K) -> P + 'static,
) -> Keyed<K>Expand description
A subtree keyed by a value: rebuilt when the key changes, left alone while it does not
(so focus and local state survive), nothing while it is None.
ⓘ
keyed(move || scene.selected.get(), |id| editor(id))key is one tracked read, compared with PartialEq on every change. The outgoing subtree’s
scope is disposed before the incoming one builds, which aborts its pending tasks and
subscriptions, exactly as when does. This is what each over a one-item list stood in
for; for an either/or on a bool, when reads better.