Skip to content
Discussion options

You must be logged in to vote

I usually recommend using the required validation constraint in this scenario:

register("age", {
  valueAsNumber: true,
  required: true // or a validation error message string
})

This way the validation fails if NaN is received.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@aphilas
Comment options

Answer selected by aphilas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants