Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
better docs

Co-authored-by: Damian Tarnawski <gthetarnav@gmail.com>
  • Loading branch information
AlexErrant and thetarnav authored Jan 4, 2025
1 parent 1d13567 commit 3f1cf04
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/keyed/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ Creates a list of elements by mapping Map entries. Similar to Solid's `<For>` an
```tsx
import { MapEntries } from "@solid-primitives/keyed";

const [map, setMap] = createSignal(new Map());

<MapEntries of={map()} fallback={<div>No items</div>}>
{(key, value) => (
<div>
Expand All @@ -175,6 +177,8 @@ import { MapEntries } from "@solid-primitives/keyed";

Third argument of the map function is an index signal.

`MapEntries` is using [`Map#key()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/keys) so the index and resulting JSX will follow the insertion order.

```tsx
<MapEntries of={map()} fallback={<div>No items</div>}>
{(key, value, index) => (
Expand Down

0 comments on commit 3f1cf04

Please sign in to comment.