0

I am a beginner in react and got stuck upon fetching multiple API request. Basically, my api requests are independent to each other and the result from the first fetch is not required by the other so, how do i fetch both the APIs? should i use .then and execute one fetching after the completion of other or should both be fetched at the same time?

  • If neither is dependent on the other why not just call both at the same time? Maybe `Promise.all(..your calls here..)` would be the right semantic – azium May 31 '21 at 17:10
  • For the second api call, i have to loop through each page number and obtain the data therefore, i thought maybe calling it after the first ends would be better! –  May 31 '21 at 17:16
  • I mean, whatever works right. are you worried about something going wrong? – azium May 31 '21 at 17:28
  • No, not at all. –  May 31 '21 at 19:00

0 Answers0