pub fn Keyed<T, F, K, Key>(props: KeyedProps<T, F, K, Key>) -> TemplateResult
Expand description
Keyed iteration. Use this instead of directly rendering an array of TemplateResult
s.
Using this will minimize re-renders instead of re-rendering every single node on every state change.
For non keyed iteration, see Indexed
.
ยงExample
use maple_core::prelude::*;
let count = Signal::new(vec![1, 2]);
let node = template! {
Keyed(KeyedProps {
iterable: count.handle(),
template: |item| template! {
li { (item) }
},
key: |item| *item,
})
};