+ 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) } }
3 Answers
+ 1
John Bryan Please share complete code from code playground.
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