← Trail· Lesson 5 of 8
Lists and keys
Render arrays with map and stable keys.
TODO i18n: Full body translation pending. Title and description are localized; the body below remains in Portuguese for now.
Para listas, use .map() e uma key estável (id). Keys ajudam o React a reconciliar itens.
const items = [{ id: 'a', label: 'Alpha' }, { id: 'b', label: 'Beta' }];
function App() {
return (
<ul>
{items.map((item) => (
<li key={item.id}>{item.label}</li>
))}
</ul>
);
}