I'm trying to learn React by building a "movie search app". The main problem is that, I have an array of request URLs and I want to retrieve each object and push them into a state array and then update the state, however pushing to the state array doesn't work.
promises = arr.map(el=>fetch(requesturl).then(e=>e.json()))
result = promises => Promise.all(promises).then(value=>console.log(value));
The code looks something like this. Instead of printing them into the console, I want to save all of them and then update the view.
Apologies, if the question is unclear.
setStatein the component with the new arrayresult = promises => Promise.all(promises).then(value=>{ let arr = this.state.titles.concat(value); this.setState({titles : arr}); });