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.
答案 0 :(得分:0)
最好的方法是install validator.js from npm
。
npm install validator
用法:
import validator from 'validator';
// example
validator.isEmail('foo@bar.com'); // use it in handleChange or functions being called
我希望这会有所帮助。这是 npm
的链接