import { useEffect, useState } from 'react'; import { getActiveCarpools } from '../api'; import { ICarpool } from '../types'; import UILink from '../UI/UILink'; import UISecondaryBox from '../UI/UISecondaryBox'; function ActiveCarpoolListItem({ carpool }: { carpool: ICarpool }) { return (

{carpool.name}

View carpool
); } export default function ActiveCarpools() { const [activeCarpools, setActiveCarpools] = useState([]); useEffect(() => { getActiveCarpools().then(setActiveCarpools); }, []); return (

Carpools

{activeCarpools.length > 0 ? activeCarpools.map((carpool) => ( )) : "No Carpools"}
); }