Skip to content
Discussion options

You must be logged in to vote

Hi,

Fortunately, I found the reason why my input was neglected.

onChange handler was overridden, but I did not call super method.

I wanted to clear errors if a user touches or clicks the fields, and now it works with the following codes:

  const {
    register,
    handleSubmit,
    formState: { errors, isSubmitSuccessful },
    clearErrors,
    reset,
  } = useForm<SignInForm>({
    mode: 'onBlur',
    defaultValues: {
      email: '',
      password: '',
    },
    resolver: yupResolver(schema),
  });

... 

  const email = register('email', { required: true });

...

  <input
        type="password"
        placeholder="password"
        className="border"
        {...password}
        o…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mairoo
Comment options

Answer selected by mairoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant