So I am wondering if it is possible to send the handleDictionaryResponse and handlePhotosResponse functions as props to the component 🙏🏾
function handleDictionaryResponse(response) {
setData(response.data[0]);
}
function handlePhotosResponse(response) {
setPhotos(response.data.photos);
}
function handleSearch(event) {
event.preventDefault();
let dictionaryApiUrl = `https://api.dictionaryapi.dev/api/v2/entries/en/${keyword}`;
axios.get(dictionaryApiUrl).then(handleDictionaryResponse);
let photosApiKey = `563492ad6f917000010000010a8428d27f1b43e6bc66cfe662ea13df`;
let photosApiUrl = `https://api.pexels.com/v1/search?query=${keyword}&per_page=9`;
let headers = { Authorization: `Bearer ${photosApiKey}` };
axios.get(photosApiUrl, { headers: headers }).then(handlePhotosResponse);
}
function updateKeywordDetails(event) {
setKeyword(event.target.value);
}
return (
<Body property={data} />
</div>
);
}