File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " @solidjs/signals " : patch
3+ " solid-js " : patch
4+ ---
5+
6+ Document the mode-specific callback shapes for mapArray and For.
Original file line number Diff line number Diff line change @@ -16,9 +16,14 @@ export type Maybe<T> = T | void | null | undefined | false;
1616
1717/**
1818 * Reactively maps an array, reusing the previously-mapped value for unchanged
19- * items. By default, the callback receives the raw row value and a reactive
20- * index accessor. Index-owned and custom-keyed rows receive accessors where
21- * the row can be preserved while that argument changes.
19+ * items.
20+ *
21+ * The callback shape follows the keying mode:
22+ * - default / `keyed: true` receives `(item, index)` where `item` is the raw
23+ * row value and `index` is an accessor.
24+ * - `keyed: false` receives `(item, index)` where `item` is an accessor and
25+ * `index` is a stable number.
26+ * - `keyed: item => key` receives accessors for both arguments.
2227 *
2328 * This is the underlying helper that powers `<For>`. App code should use
2429 * `<For>` directly; reach for `mapArray` when implementing custom list
Original file line number Diff line number Diff line change @@ -35,6 +35,13 @@ const narrowedError = (name: string) =>
3535 * Receives a map function as its child and returns a JSX element for each
3636 * list item; if the list is empty, an optional `fallback` is rendered instead.
3737 *
38+ * The child callback shape follows the keying mode:
39+ * - default / `keyed={true}` receives `(item, index)` where `item` is the raw
40+ * row value and `index` is an accessor.
41+ * - `keyed={false}` receives `(item, index)` where `item` is an accessor and
42+ * `index` is a stable number.
43+ * - `keyed={(item) => key}` receives accessors for both arguments.
44+ *
3845 * @example
3946 * ```tsx
4047 * <For each={items} fallback={<div>No items</div>}>
Original file line number Diff line number Diff line change @@ -37,7 +37,6 @@ type ForOptions<T> = {
3737
3838/**
3939 * Creates a list of elements from a list
40- *
4140 * @description https://docs.solidjs.com/reference/components/for
4241 */
4342export function For < T extends readonly any [ ] , U extends SolidElement > ( props : {
You can’t perform that action at this time.
0 commit comments