Relative Content

Tag Archive for react-hook-formyup

How to validate an Input when changing another Input in React Hook Form with Yup?

I have a schema created with yup used in conjunction with react-hook-form. The problem is that I have two Inputs that depend on each other. When I enter text into Input1 and Input2 is empty, then Input1 gets an error. But when I change the value of Input2 and it does not become empty, then the error for Input1 does not disappear. As far as I understand, this is because react-hook-form validates only one Input, and not all Inputs in the circuit. What should I do?