Skip to content

Instantly share code, notes, and snippets.

@dillingham
Created November 1, 2019 22:33
Show Gist options
  • Save dillingham/8e904cddf09cbbfda06ffdcbe5650a14 to your computer and use it in GitHub Desktop.
Save dillingham/8e904cddf09cbbfda06ffdcbe5650a14 to your computer and use it in GitHub Desktop.
bind = (key, callback = null) => {
return {
value: this.state[key],
onChange: (event) => {
this.setState({
[key]: event.currentTarget.value
});
if (callback) {
callback(event);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment