I use react-hook-forms
with typescript and react native. When I set the defaultValues
field in the useForm
method I need to have in the beginning empty fields, there is no problem when the field is a string, but I have fields that for example should be a date. When I set the date to undefined
I get a warning - fieldname is missing in the 'defaultValue' prop of either its controller or useForm
, and when I try to set it to null I get some TypeScript error that the field in defaultValues
must be either a Date or undefined, since react-hook-forms
DefaultValues
type can accept each field as an actual value or undefined.
So basically for each solution I get an error / warning. How can I solve that?
Thanks ahead.