Created
March 31, 2020 22:59
-
-
Save francodalessio/4510259192e6b393a89bb2acc716fafa to your computer and use it in GitHub Desktop.
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
import { useState } from "react"; | |
function useInput(initialValue) { | |
const [state, setState] = useState(initialValue); | |
const handleChange = e => { | |
setState(e.target.value); | |
}; | |
const reset = () => { | |
setState(""); | |
}; | |
return [state, handleChange, reset]; | |
} | |
export default useInput; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment