Skip to content

Instantly share code, notes, and snippets.

@apaleslimghost
Created June 23, 2017 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apaleslimghost/a6d946808f1b85f9e1ecd8641fa45342 to your computer and use it in GitHub Desktop.
Save apaleslimghost/a6d946808f1b85f9e1ecd8641fa45342 to your computer and use it in GitHub Desktop.
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