I have the following function, lists=[] at start:
handleAddList(s) {
var temp = this.state.lists.slice();
temp.push(s);
console.log(temp);
this.setState({lists: temp},console.log(this.state.lists) );
}
why does the first console.log return the value of s but the second console.log returns []?
also, why if i remove slice() do both console.logs now show the value of s?