Skip to content

Commit cd3aa56

Browse files
committed
update
1 parent 1c42276 commit cd3aa56

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/routes/reference/reactive-utilities/index-array.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Mapping function for each index.
5656
- **Type:** `() => any`
5757

5858
Fallback accessor used when the source array is empty or falsy.
59+
The mapped result becomes a single fallback entry.
5960

6061
## Return value
6162

@@ -69,6 +70,7 @@ Returns an accessor for the mapped array.
6970
- The item argument is an accessor.
7071
- The index argument is a number.
7172
- Updating an item at the same index updates the corresponding mapped result.
73+
- Reordering the source array changes which item each index points to instead of moving mapped entries by identity.
7274
- This is the underlying helper for [`<Index>`](/reference/components/index-component).
7375

7476
## Examples
@@ -79,13 +81,13 @@ Returns an accessor for the mapped array.
7981
import { createSignal, indexArray } from "solid-js";
8082

8183
const [source] = createSignal([
82-
{ firstName: "Ada", lastName: "Lovelace" },
83-
{ firstName: "Grace", lastName: "Hopper" },
84+
{ status: "pending" },
85+
{ status: "done" },
8486
]);
8587

8688
const mapped = indexArray(source, (item, index) => ({
8789
index,
88-
fullName: () => `${item().firstName} ${item().lastName}`,
90+
status: () => item().status,
8991
}));
9092
```
9193

0 commit comments

Comments
 (0)