Skip to content

Commit c676d83

Browse files
authored
Merge pull request #225 from marcagba/fix/rescript-react-index-as-key-example
[docs/react] Fix keys and arrays example
2 parents e7dae68 + a4f38b5 commit c676d83

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pages/docs/react/latest/arrays-and-keys.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ let items = Belt.Array.map(todos, todo => {
4141

4242
If you don’t have stable IDs for rendered items, you may use the item index as a key as a last resort:
4343

44-
```res {2,3}
45-
let items = Belt.Array.mapWithIndex(todos, (todo, i) => {
44+
```res {1..3}
45+
let items = Belt.Array.mapWithIndex(todos, (i, todo) => {
4646
// Only do this if items have no stable id
47-
<li key={i}>
47+
<li key={Belt.Int.toString(i)}>
4848
{todo.text}
4949
</li>
5050
});

0 commit comments

Comments
 (0)