Created
July 13, 2017 22:09
-
-
Save SherryH/f5737e75881f453f9e8448467fcb4cdf to your computer and use it in GitHub Desktop.
This file contains 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
import react from 'react'; | |
class Person extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
name: '' | |
}; | |
this.handleChange = this.handleChange.bind(this); | |
} | |
handleChange(e) { | |
this.setState({ | |
name: e.target.value | |
}); | |
} | |
render() { | |
return ( | |
<div> | |
<input value={this.state.name} onChange={this.handleChange} /> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment