-
-
Notifications
You must be signed in to change notification settings - Fork 204
Description
Hello react-hook-form,
First of all, thank you for a great form library! However, I am noticing an issue with propagating the ref of the input that threw the error when I use the Joi resolver in my project.
According to the docs here: https://react-hook-form.com/api#errors I should receive type, types, message and ref from the errors object. I have confirmed that this is true when I don't use a resolver and construct my field validation manually like so:
console.log(errors);
<input
ref={register({ required: 'custom required message' })}
type="email"
name="email"
...etc.
/>
...but when I construct my field validations via Joi I only receive the message and type properties from the errors object. My code looks something like this:
const { register, errors } = useForm<FormValues>({
resolver: joiResolver(validationSchema.current),
});
console.log(errors);
<input
ref={register}
type="email"
name="email"
...etc.
/>
...and my response looks like this:

How do I ensure that the ref of the input which threw the error comes through in the useForm errors object?
Thanks for your help!
