when API called as OPTION in react redux code example
Example 1: react must be in scope when using jsx
Must include "React" in the import line, see line 2.
Import React, { Component } from "react";
Example 2: what is state in react
// State is essentially a global class variable
// that is modified when the component updates
class Clock extends React.Component {
constructor(props) {
super(props);
this.state = {date: new Date()};
}
render() {
return (
<div>
<h1>Hello, world!</h1>
<h2>It is {this.state.date.toLocaleTimeString()}.</h2>
</div>
);
}
}