React Hook Form Treating Optional Fields as Required When Using Zod Resolver #12641
Unanswered
bahag-hamidk
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I’m using React Hook Form with Zod for form validation. My schema has optional fields using
.partial()
, and when I manually validate the schema withsafeParse()
, it correctly treats the fields as optional. However, React Hook Form still considers them required and showing validation errors when they are left empty.Key Observations:
Our Use Case:
Codesandbox
Here is the schema code:
Here is the component code
Beta Was this translation helpful? Give feedback.
All reactions