Reputation: 156
I want to use validator.js to do some validation on my form input. I just want to know what is the best way to use it, or if it exist an other lib to do validation whitout changing my html.
Upvotes: 0
Views: 484
Reputation: 937
The best way is to install validator.js from npm
.
npm install validator
Usage:
import validator from 'validator';
// example
validator.isEmail('[email protected]'); // use it in handleChange or functions being called
I hope this helps. Here is the link to npm
Upvotes: 1