Simplify your form handling and validation with easy-peasy-forms-2
.
To install, run the following in your project directory:
npm install easy-peasy-forms-2
First, define your form schema using yup
:
const EasyPeasyForm = require('easy-peasy-forms-2');
const yup = require('yup');
const formSchema = {
name: yup.string().required(),
age: yup.number().positive().integer().required(),
};
const myForm = new EasyPeasyForm(formSchema);
const formData = {
name: 'John Doe',
age: 29
};
myForm.submit(formData)
.then(response => console.log(response))
.catch(error => console.error(error));
- Easy form validation using
yup
- Simplified form submission