showing results for - "how to validate email in useform"
Valentina
06 Jan 2020
1  const {
2    control,
3    handleSubmit,
4    formState: { errors }
5  } = useForm<FormValues>();
6
7  <InputComponent 
8	{...otherProps}
9    control={control}
10    error={errors.email?.message}
11    rules={{
12        required: 'Enter Email',
13        pattern: {
14          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,}))$/,
15          message: 'Please enter a valid Email'
16        }
17     }}
18  />
similar questions
queries leading to this page
how to validate email in useform