DEV Community

loading...

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;
Thread Thread
adancarrasco profile image
Adán Carrasco Author

Thanks for the example luigicampbell!