score:3

Accepted answer

use promise.all to get a single promise that resolves with an array of values once every promise in the array has resolved:

const storypromises = ids.data.map(id => {
  return axios.get(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
});

const stories = await promise.all( storypromises );

this.setstate({ data: stories });

Related Query

More Query from same tag