A function that accepts an item cell and returns an element.
A cell containing an array of items to iterate over.
Optional
else?: ElementChildrenAlternative to show when array is empty.
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.
A function that accepts an item and returns an element.
An array of items to iterate over.
Optional
else?: ElementChildrenAlternative to show when array is empty.
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.
A function that accepts an item cell and returns an element.
An iterable to itearate over.
Optional
else?: ElementChildrenAlternative to show when array is empty.
const a = cellArray([1, 2, 3]);
<For each={a.indexed}>{(item, index) => {
<li>Item {item} at index {index}</li>
}</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.