This question has already been answered:
Good day. There is a Fetch request, the response of which is passed to the function argument:
fetch('url') .then((resp) => resp.json()) .then( response => { getDataFromAPI(response) }, error => alert(`Rejected: ${error}`) ); export function getDataFromAPI(data) { console.log(data) } How do I need to import it to get data in several other files?