Skip to content

Instantly share code, notes, and snippets.

@Rahmanism
Created January 21, 2023 09:46
Show Gist options
  • Save Rahmanism/ecadc966ecaef019db6ab39e5504fbe5 to your computer and use it in GitHub Desktop.
Save Rahmanism/ecadc966ecaef019db6ab39e5504fbe5 to your computer and use it in GitHub Desktop.
Using Promise.allSettled instead of Promise.all for concurrency in JavaScript
async function getData() {
const results = await Promise.allSettled({
fetchUser(),
fetchProduct()
})
const [user, product] = handle(results)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment