File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/routes/reference/reactive-utilities Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ Mapping function for each index.
5656- ** Type:** ` () => any `
5757
5858Fallback 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.
7981import { createSignal , indexArray } from " solid-js" ;
8082
8183const [source] = createSignal ([
82- { firstName : " Ada " , lastName: " Lovelace " },
83- { firstName : " Grace " , lastName: " Hopper " },
84+ { status : " pending " },
85+ { status : " done " },
8486]);
8587
8688const mapped = indexArray (source , (item , index ) => ({
8789 index ,
88- fullName : () => ` ${ item ().firstName } ${ item (). lastName } ` ,
90+ status : () => item ().status ,
8991}));
9092```
9193
You can’t perform that action at this time.
0 commit comments