Created
June 6, 2018 21:53
-
-
Save gladchinda/a31c40da54c8880e2fb115e3ac4ceeaf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ControlledFormInput extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.handleChange = this.handleChange.bind(this); | |
| this.state = { value: "Glad" }; | |
| } | |
| handleChange(evt) { | |
| this.setState({ value: evt.target.value }); | |
| } | |
| render() { | |
| return ( | |
| <div> | |
| <h1>Hello {this.state.value}!</h1> | |
| <input type="text" value={this.state.value} onChange={this.handleChange} placeholder="Enter your name" /> | |
| </div> | |
| ) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment