Skip to content

Instantly share code, notes, and snippets.

@evertonstrack
Last active April 23, 2019 13:28
Show Gist options
  • Save evertonstrack/376a1ea537b9834d5c14a85d6be8f851 to your computer and use it in GitHub Desktop.
Save evertonstrack/376a1ea537b9834d5c14a85d6be8f851 to your computer and use it in GitHub Desktop.
useInput.hook.js
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