setState() schedules an update to a component’s state object . When state changes, the component responds by re-rendering.
Read moreWhat is this setState in React?
setState() setState(updater, [callback]) setState() enqueues changes to the component state and tells React that this component and its children need to be re-rendered with the updated state . This is the primary method you use to update the user interface in response to event handlers and server responses.
Read more