I want to get the updated values of an array. When I do a console.log I only get the length of the array and the new values aren't shown in the view. What is wrong here? js fiddle
react js
getInitialState: function() {
return {
owner: "Martin Schwatz",
friends: ["Pietro", "Mike", "Shawn", "Bilbo"],
}
},
updateFriends: function(friend) {
var a = this.state.friends.push(friend);
console.log(a);
this.setState({
friends: a,
});
},
pushreturns the length of the array.