1.Whenever we call setState() method React Component get re-render.
2. State object is used to mentain Component level data which value we want to change on some action and purpose is to update DOM without page refresh.
3. Whenever setState() method get call it also invoke the lifecycle methods (Not All, e.g. if it get called from componentWillMount() state get updated but component will render only once).
4. setState is asynchronous method and also has optional parameter as callback function
e.g=>
this.setState({'Name':'Mayur'},function(){
//here you will get updated state
});
5. We can pass a function to setState that receives the previous state and props and returns a new state.
e.g=>
this.setState((prevState, props) => {
return {
amount: prevState.patient.amount - props.patient.concession
}
});
6. In Some scenario we use data using global variable that means render() method also having data other than this.state and this.props. values in this case forceUpdate() method can be used to update component values.