Correct way to push into state array
I seem to be having issues pushing data into a state array. I am trying to achieve it this way: this.setState({ myArray: this.state.myArray.push('new value') }) But I believe this is incorrect way and causes issues with mutability? Array push returns length this.state.myArray.push('new value') returns the length of the extended array, instead of the array itself. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push I guess you expect the returned value to be the array. Immutability It seems it's rather the behaviour of React: NEVER mutate this.state