dev-resources.site
for different kinds of informations.
Yup Schema Commonly Used Examples
Published at
10/15/2020
Categories
javascript
schema
yup
regex
Author
CP
Here are two commonly used schema validations using Yup:
- Phone number validation with Regex
- How to compare two fields in Yup
import * as yup from "yup";
const phoneRegex = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;
const schema = yup.object().shape({
phone: yup.string().matches(phoneRegex, "Invalid phone."),
password: yup.string().required("Password is required"),
confirmPassword: yup
.string()
.oneOf([yup.ref("password")], "Mismatched passwords")
.required("Please confirm your password")
});
export default schema;
Articles
12 articles in total
How to format SD Card to APFS on Mac
read article
How to publish data on-chain with Chainlink?
read article
Publishing Your API Documentations
read article
Simple Currency Input
read article
How-To Write a Simple Countdown with React
read article
How To Get Client IP with Javascript / React
read article
How-to Avoid Rounding "Errors" in Excel
read article
Simple URL validation with Javascript
read article
Yup Schema Commonly Used Examples
currently reading
How-to Read & Write Google Sheets with React
read article
React Bootstrap Outlined Tooltip Style/CSS
read article
Beware of Mutation in Spread & React Hooks and How Can You Fix It
read article
Featured ones: