Yup Schemas Are Validated Asynchronously
Yup provides a flexible object schema validation DSL. For instance, if you want to enforce that a certain value is a number, you can define something like this:
You can then validate anything against that schema.
The validation is async, so if it succeeds the then
block is hit. If the validation fails, it will fall through to the catch
.
Last updated