Created
November 14, 2018 15:52
-
-
Save zapkub/a3ba1846a447421489cb27872b41e848 to your computer and use it in GitHub Desktop.
put hook into function component
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
// NOW ( currently on alpha 14 nov 2018 ) THIS COMPONENT CAN HAVE STATE | |
const MyInputComponent ({ }) => { | |
const [value, setValue] = React.useState("put some default value here") | |
const onChange = (e) => setValue(e.value.target) | |
return ( | |
<input value={value} onChange={onChange} /> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment