Created
December 16, 2018 01:15
-
-
Save jeanbauer/00c06ddfa44a199dd9aa018c1f4775f2 to your computer and use it in GitHub Desktop.
Revisions
-
jeanbauer created this gist
Dec 16, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ import { useState } from 'react' const Form = () => { const name = useFormInput('Name') return ( <> <input {...name} /> </> ) } function useFormInput(initialValue) { const [value, setValue] = useState(initialValue) function handleChange(e) { setValue(e.target.value) } return { value, onChange: handleChange } } export default Form