Bagaimana cara memvalidasi email di Useform
const {
control,
handleSubmit,
formState: { errors }
} = useForm<FormValues>();
<InputComponent
{...otherProps}
control={control}
error={errors.email?.message}
rules={{
required: 'Enter Email',
pattern: {
value: /^(([^<>()\\[\]\\.,;:\s@"]+(\.[^<>()\\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
message: 'Please enter a valid Email'
}
}}
/>
Zany Zebra