Skip to content

Instantly share code, notes, and snippets.

@zapkub
Created November 14, 2018 15:52
Show Gist options
  • Save zapkub/a3ba1846a447421489cb27872b41e848 to your computer and use it in GitHub Desktop.
Save zapkub/a3ba1846a447421489cb27872b41e848 to your computer and use it in GitHub Desktop.
put hook into function component
// 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