Compare commits

..

No commits in common. '3320200c592a6bad109e90877a5206b7a42b78e0' and 'f8a24081d45d84975c289483e089ccf895b66203' have entirely different histories.

@ -1,29 +1,14 @@
import { useState } from "react";
function ListGroup() {
let items = ["New York", "San Francisco", "Tokyo", "London"];
const [selectedIndex, setSelectedIndex] = useState(-1);
let items = ['New York', 'San Francisco', 'Tokyo', 'London'];
items = [];
return (
<>
<h1>List Name</h1>
{items.length === 0 && <p>No items found</p>}
<ul className="list-group">
{items.map((item, index) => (
<li
className={
selectedIndex === index
? "list-group-item active"
: "list-group-item"
}
key={item}
onClick={()=>setSelectedIndex(index)}
>
{item}
</li>
))}
</ul>
return (
<>
<h1>List Name</h1>
{items.length === 0 && <p>No items found</p>}
<ul className="list-group">
{items.map(item => <li className="list-group-item" key={item}>{item}</li>)}
</ul>
</>
);
}

Loading…
Cancel
Save