fetch

Wait for Multiple Fetch Requests to Finish | JavaScript Tutorial

0:00
↔️ ↕️

Timecodes:

hello everyone and welcome to this

tutorial so today what I'm going to be

showing you is how you can wait for

multiple fetch requests to complete or

doing something like rendering their

content to the page so in this example

I'm fetching three types of Json data

posts comments and photos from this API

that returns fictitious Json data so to

handle requests together the first thing

that we want to do is to place all of

the requests together in an array so

I'll just copied them in

and also add a comma and remove the

spacing

and now because each fetch request is a

promise we can pass this array of

promises into a method that is available

on the promise object that is

promise.all so a pass the array in here

so you may be familiar with this object


Related queries:


fetch api javascript get example
fetch vs get api