Lesson 7 of 10
Lists & Keys
Render lists in React using map(). Each item in a list needs a unique key prop so React can track which items changed. Keys should be stable identifiers, not array indices if possible.
REACT
function FruitList() {
const fruits = ["apple", "banana", "cherry"];
return (
<ul>
{fruits.map((fruit) => (
<li key={fruit}>{fruit}</li>
))}
</ul>
);
}