Skip to content

Instantly share code, notes, and snippets.

@OleksiyRudenko
Created April 16, 2021 05:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OleksiyRudenko/667713759899e318f5b3af8dacd24c7e to your computer and use it in GitHub Desktop.
Save OleksiyRudenko/667713759899e318f5b3af8dacd24c7e to your computer and use it in GitHub Desktop.
Promise Patterns

Promise patterns

Promises chaining

anArray
  .reduce(
    (chain, x) => chain.then(() => networkCall(x)),
    Promise.resolve()
  )
  .then(() => console.log('all done'))
  .catch(() => console.error('something went wrong'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment