Skip to content

Instantly share code, notes, and snippets.

@SherryH
Created July 13, 2017 22:09
Show Gist options
  • Save SherryH/f5737e75881f453f9e8448467fcb4cdf to your computer and use it in GitHub Desktop.
Save SherryH/f5737e75881f453f9e8448467fcb4cdf to your computer and use it in GitHub Desktop.
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