Skip to content
Advertisement

Tag: yup

How can I make a yup number accept nullable values?

I have the following yup check: And right now if I leave the field blank, it validates as false. Is there any way to make yup.number() accept empty values? I have tried: But it doesn’t seem to work. Any ideas on how I can make such thing happen? Answer You have to pass true to nullable – nrOfApples: yup.number().min(0).max(999).nullable(true); From:

Advertisement