score:4

Accepted answer

Setting of state with empty object works because react doesn't do anything with the state mutation itself. Rather it just uses the state object and creates the updated Virtual DOM while the render method is called, which reflects the state mutations too.

However, the problem in doing the state mutation is that the lifecyle methods will now not be able to clearly differentiate between prevState and this.state and a lot of comparisons will fails since prevState and this.state values will both refer to the same reference.


Related Query

More Query from same tag