Last active
July 28, 2019 11:47
-
-
Save DJanoskova/8d9c442831bdfc17c931aa2775570aab to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const MaterialForm = () => { | |
| const { values, useInput, isValid } = useForm({ | |
| username: '', | |
| email: '' | |
| }); | |
| const handleSubmit = e => { | |
| e.preventDefault(); | |
| console.log(values) | |
| }; | |
| return ( | |
| <form onSubmit={handleSubmit}> | |
| <TextField | |
| label="Username *" | |
| {...useInput('username', 'isRequired')} | |
| /> | |
| <TextField | |
| label="E-mail *" | |
| {...useInput('email', 'isRequired, isEmail')} | |
| /> | |
| <Button type="submit" disabled={!isValid}> | |
| Submit | |
| </Button> | |
| </form> | |
| ) | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment