How to validate inputs when I just opened the form without touching input on React hook form

I'm using react hook form for validate my form,

  const { register, handleSubmit, formState:{errors, isValid}  } = useForm({
    mode: "onBlur"
  });

this is a header when I have button submit

  <Navigation
    toolName={toolName}
    setDropzoneError={setDropzoneError}
    isSubmit={isSubmit}
    isValid={isValid}
  />

this is a button

  <PrimaryButton
    disabled={!isValid}
    onClick={() => setDropzoneError(true)}
    name={'someName'}
    form="form"
  />

And now what I have, when I open the page, I don't see any mistake messages, but submit button is disabled, when I fill all inputs button became active, and I can press on the button, but I need to see all require fields when I just opened the page, to see all mistake for correct filling all inputs, how can I do it, anybody know, maybe should I use watch() method, or maybe this is impossible in this library, because I see only several mode onBlur, onSubmit... but there is not on coming to page or something similar...?


Ответы (0 шт):