Skip to content

Instantly share code, notes, and snippets.

@brianjlandau
Created August 25, 2015 22:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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