Ömer Şengül

Promise.all Fetching

byÖmer ŞengülCreated January 27, 2024 at 07:00 PM
Promise.all Fetching
1const fetchAll = async (urls) => {
2  const responses = await Promise.all(urls.map(url => fetch(url)));
3  return Promise.all(responses.map(res => res.json()));
4};

Description

Fetch multiple endpoints in parallel with Promise.all.

Discussion (0)

Sort by: