Skip to content

Instantly share code, notes, and snippets.

@franleplant
Forked from llopez/react-reusable-form.js
Last active August 18, 2016 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save franleplant/30c25cb62aca99a1ad3098ba06130304 to your computer and use it in GitHub Desktop.
Save franleplant/30c25cb62aca99a1ad3098ba06130304 to your computer and use it in GitHub Desktop.
class Form extends React.Component {
constructor(props) {
this.state = {
name: '',
email: ''
}
}
handleNameChange(e) {
this.setState({
name: e.target.value
})
}
handleEmailChange(e) {
this.setState({
email: e.target.value
})
}
render() {
return(
<form>
<input value={this.state.name} onChange={this.handleNameChange} />
<input value={this.state.email} onChange={this.handleEmailChange} />
</form>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment