Skip to content

Instantly share code, notes, and snippets.

@DJanoskova
Last active July 28, 2019 11:47
Show Gist options
  • Select an option

  • Save DJanoskova/8d9c442831bdfc17c931aa2775570aab to your computer and use it in GitHub Desktop.

Select an option

Save DJanoskova/8d9c442831bdfc17c931aa2775570aab to your computer and use it in GitHub Desktop.
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