11---
22title : <Index>
33use_cases : >-
4- primitive arrays, non-keyed lists, index-based rendering, static positions,
4+ non-keyed lists, index-based rendering, fixed positions, changing values ,
55 simple lists
66tags :
77 - lists
88 - iteration
99 - components
1010 - arrays
11- - primitives
1211 - index
1312version : " 1.0"
1413description : >-
@@ -48,7 +47,7 @@ Source list.
4847
4948- ** Type:** ` JSX.Element `
5049
51- Content rendered when ` each ` is empty or falsy .
50+ Content rendered when ` each ` is an empty array, ` undefined ` , ` null ` , or ` false ` .
5251
5352### ` children `
5453
@@ -66,26 +65,27 @@ Child function. It receives an accessor for the item at that index and the index
6665- The ` item ` argument is an accessor.
6766- The ` index ` argument is a number.
6867- Updating a value at the same index updates the corresponding rendered item.
68+ - When the array is reordered, rendered positions stay tied to indexes, and ` item() ` updates to the current value at that index.
6969- ` <Index> ` uses [ ` indexArray ` ] ( /reference/reactive-utilities/index-array ) internally.
7070
7171## Examples
7272
7373### Basic usage
7474
7575``` tsx
76- import { Index } from " solid-js " ;
76+ const items = [ " A " , " B " , " C " ] ;
7777
78- <Index each = { state . list } fallback = { <div >No items</div >} >
78+ <Index each = { items } fallback = { <div >No items</div >} >
7979 { (item ) => <div >{ item ()} </div >}
8080</Index >;
8181```
8282
8383### Access the index
8484
8585``` tsx
86- import { Index } from " solid-js " ;
86+ const items = [ " A " , " B " , " C " ] ;
8787
88- <Index each = { state . list } >
88+ <Index each = { items } >
8989 { (item , index ) => (
9090 <div >
9191 #{ index } { item ()}
0 commit comments