How to optimise Parallel API call in the first render when site open ?
I want to call 5 at time of first render.
How to optimise API call so that the user gets best experience?
2 Replies
If you want to make parallel
fetch()
calls you can use Promise.allSettled()
. You pass in an array of promises and when all of them have settled, you'll get an array of the results
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled