Created
August 12, 2019 07:43
-
-
Save jesperbjensen/7af8234436b9510d1e038a32ea1dd5ef to your computer and use it in GitHub Desktop.
Hooks Form Prototype Example
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
function MyFormSample() { | |
const form = useForm({ | |
firstName: useField({ name: "Firstname", validators: [requiredValidator] }), | |
lastName: useField({ name: "Lastname", validators: [requiredValidator] }) | |
}); | |
return ( | |
<div> | |
<TextField {...textFieldFieldProps(form.firstName)} /> | |
<TextField {...textFieldFieldProps(form.lastName)} /> | |
<Button disabled={!form.allFieldsValid}>Create</Button> | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment