Skip to content
Discussion options

You must be logged in to vote

There is no built-in state for these at the moment but we will have them supported very soon as you found :)

What you have above looks valid to me. But be aware that onSubmit is called only if there is no error, so if your consider the form submitted regardless there is any error, you can do this instead:

const [form, fields] = useForm({
    lastSubmission,
    shouldValidate: "onBlur",
    onValidate({ formData }) {
      const parsed = parse(formData, { schema });
      setValid(Object.keys(parsed.error).length === 0);
      if (parsed.intent === 'submit') setSubmitted(true);
      return parsed;
    },
  });

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@austinzentzkippdc
Comment options

@Pouet--
Comment options

@austinzentzkippdc
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

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

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