sycamore::web

Function Indexed

pub fn Indexed<T, U, List, F>(props: IndexedProps<T, U, List, F>) -> View
where T: PartialEq + Clone + 'static, U: Into<View>, List: Into<MaybeDyn<Vec<T>>> + 'static, F: Fn(T) -> U + 'static,
Expand description

Non keyed iteration (or keyed by index).

Use this instead of directly rendering an array of Views. Using this will minimize re-renders instead of re-rendering every single node on every state change.

For keyed iteration, see Keyed.

ยงExample

let fib = create_signal(vec![0, 1, 1, 2, 3, 5, 8]);
view! {
    ul {
        Indexed(
            list=fib,
            view=|x| view! {
                li { (x) }
            },
        )
    }
}