React | Functional components | Question 7

Last Updated :
Discuss
Comments

What is the output of the following React functional component?

JavaScript
const ItemList = (props) => {
    return (
        <ul>
            {props.items.map((item, index) => <li key={index}>{item}</li>)}
        </ul>
    );
};
<ItemList items={['Apple', 'Banana', 'Cherry']} />

Apple Banana Cherry

<ul><li>Apple</li><li>Banana</li><li>Cherry</li></ul>

Apple, Banana, Cherry

Error: map is not a function

Share your thoughts in the comments