+ 10

Sending data from handleSearch function!

Hey Everyone! How do I go about sending the data from this handleSearch function in the parent class to a child class? const [data, setData] = useState(initialData); const [searchFlight, setSearchFlight] = useState(false); const [flights, setFlights] = useState([]); const handleSearch = async() => { try{ let res = await API.search(data) setSearchFlight(true); toggleModal(); setFlights(res.data) return {data}; } catch (e) { console.log(e.message) }}

4th Jan 2021, 3:39 PM
Hardik
Hardik - avatar
1 Resposta