1class NameForm extends React.Component {
2 constructor(props) {
3 super(props);
4 this.state = {value: ''};
5
6 this.handleChange = this.handleChange.bind(this);
7 }
8
9 handleChange(event) {
10 this.setState({value: event.target.value});
11 }
12
13 render() {
14 return (
15 <form>
16 <label>
17 Name:
18 <input type="text" value={this.state.value} onChange={this.handleChange} />
19 </label>
20 <input type="submit" value="Submit" />
21 </form>
22 );
23 }
24}