First of all setting the state directly by this.state.name=”Thomas” is not recommended in React. In React we should never mutate state directly instead of using setState to change the state. One more drawback of setting state directly is that React’s lifecycle methods — shouldComponentUpdate(), componentWillUpdate(), componentDidUpdate() and render()- depend on state transitions being called with setState().