Function For

  • Iterate over an array of items and render an element for each. When the cell updates the existing DOM-elements will be reused, but an update will be emitted for each item in the array.

    Type Parameters

    • TItem

    Parameters

    Returns JSX.Element

    Example

    const a = cell([1, 2, 3]);
    <For each={a}>{(item, index) => {
    <li>Item {item} and index {index}</li>
    }</For>
  • Iterate over a static array of items and render an element for each.

    Type Parameters

    • TItem

    Parameters

    Returns JSX.Element

    Example

    const a = [1, 2, 3];
    <For each={a}>{(item, index) => {
    <li>Item {item} and index {index}</li>
    }</For>
  • Iterate over a CellIterable of items and keys. See cellArray for information on creating dynamic cell arrays.

    Type Parameters

    • TItem
    • TKey

    Parameters

    Returns JSX.Element

    Example

    const a = cellArray([1, 2, 3]);
    <For each={a.indexed}>{(item, index) => {
    <li>Item {item} at index {index}</li>
    }</For>