Replies: 1 comment
-
My personal advice would be to use the validator of React-hook-form. After using yup schema too many times, I have learned that schema object gets less and less readable as the complexity of the form increases. Plus you have to consider everything very carefully, like triggering for example, will not work the same with a schema object as it does with factory default |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Version Number
7.43.9
Codesandbox/Expo snack
none
Steps to reproduce
I have a form where validation is like
I can submit this form with an empty title although I have specified in zod scheme that title is a required field
typscript flags default values as an error because price is "" instead of a number.
Expected behaviour
Form should not be allowed to be submitted with and empty string
Should be able to specify default value of "" for number
The reason is when I use reset i want these fields to be empty.
If i do not put title as "" in default values then this field is not reset when using the reset function
If I put price as 0 then its reset to 0 instead of making the field empty.
What browsers are you seeing the problem on?
No response
Relevant log output
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions