Last active
April 23, 2019 13:28
-
-
Save evertonstrack/376a1ea537b9834d5c14a85d6be8f851 to your computer and use it in GitHub Desktop.
useInput.hook.js
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
export function useInput(initialValue = '') { | |
const [value, setValue] = useState(initialValue); | |
const onChange = e => setValue(e.target.value); | |
return { onChange, value } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment