Keyed

Function Keyed 

Source
pub fn Keyed<T, F, K, Key>(props: KeyedProps<T, F, K, Key>) -> TemplateResult
where F: Fn(T) -> TemplateResult + 'static, K: Fn(&T) -> Key + 'static, Key: Clone + Hash + Eq + 'static, T: Clone + PartialEq,
Expand description

Keyed iteration. Use this instead of directly rendering an array of TemplateResults. 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,
    })
};