Created
February 9, 2019 23:35
-
-
Save nadeesha/cf5942bab7a14faae508f123d33bf3f1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// https://github.com/acdlite/recompose/blob/master/docs/API.md | |
const enhance = compose( | |
withState('value', 'updateValue', ''), | |
withHandlers({ | |
onChange: props => event => { | |
props.updateValue(event.target.value) | |
}, | |
onSubmit: props => event => { | |
event.preventDefault() | |
submitForm(props.value) | |
} | |
}) | |
) | |
const Form = enhance(({ value, onChange, onSubmit }) => | |
<form onSubmit={onSubmit}> | |
<label>Value | |
<input type="text" value={value} onChange={onChange} /> | |
</label> | |
</form> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment