DEV Community

Discussion on: Caching API requests in JavaScript

Collapse
 
luigicampbell profile image
luigicampbell

I think Leo means you can await the json call within the async function.

I think something like:

const res = await fetch(url);
const weatherInfo = await res.json();

return weatherInfo;
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
adancarrasco profile image
Adán Carrasco

Thanks for the example luigicampbell!