Skip to content

Commit 445ca97

Browse files
author
bugouchengshut
committed
Add key and improve clarity in people.map() example
1 parent 4bea66b commit 445ca97

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/content/learn/rendering-lists.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ const people = [
7272
];
7373

7474
export default function List() {
75-
const listItems = people.map(person =>
76-
<li>{person}</li>
75+
const listItems = people.map((person, index) =>
76+
<li key={index}>{person}</li>
7777
);
7878
return <ul>{listItems}</ul>;
7979
}

0 commit comments

Comments
 (0)