import React, { useState, useEffect, useCallback, FormEventHandler, } from 'react'; import { useParams } from 'react-router-dom'; const UpdatePool = () => { const id = useParams<{ id: string }>().id; // eslint-disable-next-line const [pool, setPool] = useState({ id: 1, pool_title: 'TJ Carpool', 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 callAPI = useCallback(() => { fetch(`${process.env.REACT_APP_API_ENDPOINT}/pool/${id}`) .then((response) => response.json()) .then((data) => { if (data !== undefined) { setPool(data); } }); }, [id]); const onSubmit: FormEventHandler = (e) => { e.preventDefault(); fetch(`${process.env.REACT_APP_API_ENDPOINT}/update_pool`) .then((response) => response.json()) .then((data) => { console.log(data); }); }; useEffect(() => { callAPI(); }, [callAPI]); return (

Update Pool


); }; export default UpdatePool;