State
The state is an updatable structure that is used to contain data or information about the component.
React components has a built-in state object.
The state object is where you store property values that belongs to the component.
When the state object changes, the component re-renders.
The state object is initialized in the constructor:
state object anywhere in the component by using the (this.state.propertyname).
To change a value in the state object, use the this.setState() method.
value in the state object changes, the component will re-render,
the output will change according to the new value(s).
setState()This method is used to update the state of the component. This method does not always replace the state immediately. Instead, it only adds changes to the original state. It is a primary method that is used to update the user interface(UI) in response to event handlers and server responses.