Skip to content

Instantly share code, notes, and snippets.

@lightsofapollo
Last active March 1, 2018 23:10
Show Gist options
  • Save lightsofapollo/46a3a4ec006985ae9780b19c96c6c01d to your computer and use it in GitHub Desktop.
Save lightsofapollo/46a3a4ec006985ae9780b19c96c6c01d to your computer and use it in GitHub Desktop.
const handleChange = name => {
return e => {
this.setState({
[name]: e.target.value,
});
};
};
class Foo extends Component {
handleFooChange = handleChange('foo')
render() {
return <input onChange={handleFooChange} />
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment