i'm new on React Js things. already tried push object into array.
I already got the result using axios, but i can't push it to array.the result always return last array, F.ex : [0]: {channel:"esl_dota2", stream:null},[1]: {channel:"esl_dota2", stream:null},[2]: {channel:"esl_dota2", stream:null},[3]: {channel:"esl_dota2", stream:null},[4]: {channel:"esl_dota2", stream:null},
GetStream(){
var channels = ['comster404', 'freecodecamp', 'noobs2ninjas', 'esl_dota2', 'ESL_SC2'];
var temp = [];
var tempObj = {};
channels.map((i) => {
axios({
url: this.state.API_URL + i
})
.then(yeah => {
console.log(i);
tempObj.channel = i;
tempObj.stream = yeah.data.stream;
temp.push(tempObj);
})
.catch(oops => {
console.log(oops.status);
});
});
console.log(temp);}