Skip to content

Instantly share code, notes, and snippets.

@Xedii
Last active December 31, 2018 08:54
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 Xedii/6d528d4d6ca059a639aeea08902c71e0 to your computer and use it in GitHub Desktop.
Save Xedii/6d528d4d6ca059a639aeea08902c71e0 to your computer and use it in GitHub Desktop.
const makeRequest = async () => {
try {
const res = await requestMock();
return res.data.arr.map(test => test + 2);
} catch (err) {
console.log(err)
}
}
const multipleRequest = async () => {
await makreRequest() // It is not obligatory to declare the value. We can use the same function.
const [req1, res1, req3] = await Promise.all([makeRequest, makeRequest, makeRequest])
console.log([…req1, …req2, …req3 ])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment