Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Allows you to abstract out the common behaviour of wanting to create an onChange function that just sets the Colonel Kurtz value based on the input value.
/**
* SharedOnChange Colonel Kurtz Mixin
* Allows you to abstract out the common behaviour of wanting to
* create an onChange function that just sets the CK value
* based on the input value.
*/
var React = require('react')
module.exports = {
_onChangeFor(fieldName) {
return this._sharedOnChange.bind(this, fieldName)
},
_sharedOnChange(fieldName, e) {
this.props.onChange({
[fieldName]: e.currentTarget.value
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.