Skip to content

Instantly share code, notes, and snippets.

@flatlinediver
Created March 1, 2019 00:58
Show Gist options
  • Save flatlinediver/9865778de8f25b835e16647498a1b824 to your computer and use it in GitHub Desktop.
Save flatlinediver/9865778de8f25b835e16647498a1b824 to your computer and use it in GitHub Desktop.
Handling input using React Hooks
import React, {useState} from 'react'
export const Input = () => {
const [ inputValue, setinputValue ] = useState()
const handleChange = ({ target: {value} }) => setinputValue(value)
return(
<input name='name' value={ inputValue } onChange={ handleChange }/>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment