File tree Expand file tree Collapse file tree
src/routes/reference/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ Source list.
4949
5050- ** Type:** ` JSX.Element `
5151
52- Content rendered when ` each ` is empty or falsy .
52+ Content rendered when ` each ` is an empty array, ` undefined ` , ` null ` , or ` false ` .
5353
5454### ` children `
5555
@@ -64,28 +64,24 @@ Child function. It receives the current item and an index accessor.
6464## Behavior
6565
6666- ` <For> ` maps items by value identity.
67+ - If the same item value appears at a new position, its rendered node can be moved instead of recreated.
6768- The ` index ` argument is an accessor.
68- - Reordering reuses rendered items whose source values are retained.
6969- ` <For> ` uses [ ` mapArray ` ] ( /reference/reactive-utilities/map-array ) internally.
7070
7171## Examples
7272
7373### Basic usage
7474
7575``` tsx
76- import { For } from " solid-js" ;
77-
78- <For each = { state .list } fallback = { <div >No items</div >} >
76+ <For each = { items ()} fallback = { <div >No items</div >} >
7977 { (item ) => <div >{ item } </div >}
8078</For >;
8179```
8280
8381### Access the index
8482
8583``` tsx
86- import { For } from " solid-js" ;
87-
88- <For each = { state .list } >
84+ <For each = { items ()} >
8985 { (item , index ) => (
9086 <div >
9187 #{ index ()} { item }
You can’t perform that action at this time.
0 commit comments