Created
June 23, 2017 20:19
-
-
Save apaleslimghost/a6d946808f1b85f9e1ecd8641fa45342 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {createElement: h} = require('react'); | |
const iteratee = require('lodash.iteratee'); | |
const Field = props => { | |
const {name, setState, getValue = 'value'} = props; | |
const getValueFn = iteratee(getValue); | |
return h('input', Object.assign({}, props, { | |
onInput: ev => setState({[name]: getValueFn(ev)}) | |
})); | |
}; | |
module.exports = Field; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment