-
-
Save Xedii/6d528d4d6ca059a639aeea08902c71e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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