79699581

Date: 2025-07-12 21:06:18
Score: 1.5
Natty:
Report link

react-hook-form Yup resolver is not working #11342

https://github.com/orgs/react-hook-form/discussions/11342

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));
Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Fritz Lin