InterviewSolution
Saved Bookmarks
| 1. |
What is the difference between this.state.name=”Thomas” and this.setState({name: “Thomas”}) ? |
|
Answer» FIRST of all setting the STATE directly by this.state.name=”Thomas” is not recommended in REACT. 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(). |
|