react async loop
const promises = [];
for (let i=30; i >= 1; i--) {
const date = new Date();
const previousDay = Math.floor(date.setDate(date.getDate() - i) / 1000);
const url = `/api/darksky?latitude=${current.latitude}&longitude=${current.longitude},${previousDay}`;
promises.push(darkSky(url, this.onTimeRequestSuccess, this.onError));
}
Promise.all(promises).then(arrOfResults => {
// setState here
});