L
L
lexstile2020-12-23 18:48:36
React
lexstile, 2020-12-23 18:48:36

React hook form: why isValid first returns true and then false?

When reloading the page, isValid first gets true, then false. DOCA
If I make focus (onFocus) in any field of the form and lose it (onBlur) - it will already return true.
What nonsense?

const methods = useForm({
    mode: 'onBlur',
    reValidateMode: 'onChange',
    defaultValues: {
      applicants,
    },
    validationResolver: validationResolverBorrowersProfile,
    validationContext: {application: get(store.getState(), 'application')},
    validateCriteriaMode: 'all',
  });
  const {fields, append} = useFieldArray({control: methods.control, name: 'applicants'});

  const {isValid} = methods.formState;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question