Skip to content

Instantly share code, notes, and snippets.

@Xedii Xedii/combination-async.js Secret
Last active Dec 31, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.