Skip to content

Instantly share code, notes, and snippets.

@johhansantana
Created April 20, 2017 21:33
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 johhansantana/34527288cd75ef0a32d5f60d685f2f46 to your computer and use it in GitHub Desktop.
Save johhansantana/34527288cd75ef0a32d5f60d685f2f46 to your computer and use it in GitHub Desktop.
Run multiple async/await functions simultaneously
async () => {
try {
const [locations, categories] = await Promise.all([
getLocations(),
getCategories()
])
this.setState({locations, categories, loading: false});
} catch (err) {
alert("Error: " + err.code + " " + err.message);
this.setState({loading: false});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment