conditional rendering

main
Gerardo Marx 3 weeks ago
parent 6ecb3d36e3
commit f8a24081d4

@ -1,9 +1,11 @@
function ListGroup() { function ListGroup() {
const items = ['New York', 'San Francisco', 'Tokyo', 'London']; let items = ['New York', 'San Francisco', 'Tokyo', 'London'];
items = [];
return ( return (
<> <>
<h1>List Name</h1> <h1>List Name</h1>
{items.length === 0 && <p>No items found</p>}
<ul className="list-group"> <ul className="list-group">
{items.map(item => <li className="list-group-item" key={item}>{item}</li>)} {items.map(item => <li className="list-group-item" key={item}>{item}</li>)}
</ul> </ul>

Loading…
Cancel
Save