+ 1

Api calls at componentDidMount()

Im trying to call an api 5 times at componentDidMount() in react and push the result into an empty array but my react app does not show any errors and does not stop loading Assume i have installed axios componentDidMount() { let store =[ ] while(store.length <5) { axios.get(API_URL).then(response =>{ store.push(response) } }

25th Jun 2020, 5:03 PM
John Bryan
3 Réponses
+ 1
John Bryan Please share complete code from code playground.
27th Jun 2020, 7:36 AM
Calviղ
Calviղ - avatar
27th Jun 2020, 9:55 AM
John Bryan
0
I wish i could send you a screenshot Writing code on my phone is a bit hard but the above was the best i could Hope it helps you to figure out my problem
27th Jun 2020, 9:58 AM
John Bryan