Created
December 27, 2018 09:01
-
-
Save mDibyo/d693daa3c63c39b065a2648891d164d0 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
class HookedInput extends React.PureComponent { | |
render() { | |
// `withHook` creates a new function component that calls `useFormInput` | |
// that passes the return value to its children. | |
const WithFormInputProps = withHook(useFormInput); | |
return ( | |
<WithFormInputProps> | |
{({ value, onChange }) => <input value={value} onChange={onChange} />} | |
</WithFormInputProps> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment