import { useForm } from 'exeform';
Values = {
[key: string]: any
}
Errors = {
[path: string]: string
}
Validate(values: Values): Errors
Options = {
initialValues: Values
validate?: Validate
}
useForm(options: Options): Form
const validate = (values) => {
const errors = {};
if (!values.email) {
errors.email = 'This field is required';
}
if (!values.password) {
errors.password = 'This field is required';
}
return errors;
};
const form = useForm({
validate,
initialValues: {
email: '',
password: '',
},
});