What will this code output? jsx Copy code

Last Updated :
Discuss
Comments

What will this code output?

const items = ['A', 'B'];

return (

<ul>

{items.map((item, index) => <li key={index}>{item}</li>)}

</ul>

);

A list with items A and B

Error due to missing keys

Nothing will render

Only the first item renders

Share your thoughts in the comments