import { useState, useEffect, FormEventHandler, useCallback } from 'react'; import { useParams } from 'react-router'; const Pool = () => { const id = useParams<{ id: string }>().id; const [state, setState] = useState({ pool_title: 'TJ Carpool', id: 1, pool_text: 'Carpool from TJ track to homes', start_time: '4/10/2021 3:00 PM', end_time: '4/10/2021 4:00 PM', capacity: 2, participants: [], comments: ['What is the covid vaccination status of all the participants?'], }); const [registered, setRegistered] = useState(false); const onComment = useCallback>((e) => { e.preventDefault(); fetch(`${process.env.REACT_APP_API_ENDPOINT}/pool/comments`) .then((response) => response.json()) .then((data) => { console.log(data); }); }, []); useEffect(() => { fetch(`${process.env.REACT_APP_API_ENDPOINT}/pool/${id}`) .then((response) => response.json()) .then((data) => { if (data !== undefined) { setState(data); } }); }, [id]); return (

Pool {id}

{state.pool_title}

Capacity: {state.participants.length} / {state.capacity}

Start Time: {state.start_time}

End Time: {state.end_time}

{state.pool_text}