← All snippets
Promise.all Parallel Fetch
Fire multiple async requests in parallel and wait for all of them — dramatically faster than sequential awaits.
utilitiesCode
const urls = ["/api/a", "/api/b", "/api/c"]
const results = await Promise.all(
urls.map((u) => fetch(u).then((r) => r.json()))
)
// results = [dataA, dataB, dataC]