While working with ReactJS setState method to update state I observed that post increment operator was not working(did not get any error as well) so I had to use + 1 instead for the same. Any idea why this behaviour as I am new to React and got shocked to learn this.
Here is my code: This did not work:
this.setState((prevState) => ({
left: prevState.left++
}));
This worked:
this.setState((prevState) => ({
left: prevState.left + 1
}));