June 21, 2020
Why should we not update the state directly?
If you try to update state directly then it won't re-render the component.
Instead, use setState()
method. It schedules an update to a component's state object. When state changes, the component responds by re-rendering.
Note: You can directly assign to the state object either in constructor or using the latest java script's class field declaration syntax.