State in React
When a user interacts with a software system, in order to provide relevant output, the system needs to be aware of the user inputs and also any previous interactions between the user and the system. This can then be used to evaluate the output. In React, such information can be stored in a data store called state, which is available to the components. State allows us to make the UI interactive, where interactions such as mouse and keyboard events trigger changes in the Model store, effectively changing the rendered component.
Let's look at an example of a component that toggles the component's state to show a greeting message when a button is clicked:
class App extends Component {   constructor(props) {     super(props);     this.state = {       isActive: false     };   }   render() {     const { isActive } = this...