Skip to content

Yup resolver is not working #11342

Answered by fritx
RiyaadHossain asked this question in Q&A
Dec 27, 2023 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

Finally got it to work:

useForm({
  // ...
  resolver: yupResolver(schema),
})
// ...
await trigger()
// Important Note: given time/ticks to make formState.errors working with yup schema
await sleep(0);
formState.errors // is ok with yup schema

// with util
export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

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

Answer selected by RiyaadHossain
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