Sat. Apr 4th, 2026
import React from "react";


function App() {
const animals = ["Dog", "Cat", "Elephant", "Lion", "Tiger"];


return (
<div>
<h1>Animal List</h1>
<List items={animals} />
</div>
);
}


export default App;


function List({ items }) {
return (
<ul>
{items.map((item, index) => (
<likey={index}>{item}</li>// Always add a unique key
))}
</ul>
);
}

Following is the react code…

Leave a Reply

Your email address will not be published. Required fields are marked *