I was following this tutorial, And on 1:10:18 (timestep included in link) he wrote this.setState({ count: this.state.count + 1 }); (where count is a primitive value inside state object, that is then displayed on page after button click) From tutors words i understood that we need to specify count: inside setState so that React will update this value in state object. But i noticed that i can just write some bullshit in setState like:
handleIncrement = key => {
this.state.totalCount += 1;
this.state.tags[key] += 1;
this.setState({ countBlabla: 23213123 });
};
And HTML still will be updated correctly, without re-rendering everything. (I've checked in developer tools, only values that were changed are updated, everything else is untouched)
I have also tried: this.setState({}); works good. But this.setState(); does not.
So what's the point of passing setState a parameter?