Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including react-validator-ease with all npm packages installed. Try it out:

var reactValidatorEase = require("react-validator-ease")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

react-validator-ease v0.0.9

react-validator in your react appliction is so ease


react-validator in your react appliction is so ease




npm install react-validator-ease or yarn install react-validator-ease


  • link

const ReactValidator from 'react-valid-ease'

  • es5
componentWillMount: function() {
  this.validator = new ReactValidator();
  • es6
constructor() {
  this.validator = new ReactValidator();
  • jsx
  render: function() {
    return (
      <div className="container card my-4">
        <div className="card-block">
          <h3>Example Form</h3>

          <div className="form-group">
            <input className="form-control" name="email" value={} onChange={this.setStateFromInput} />
            {this.validator.message('email',, 'required|email','',{
              required: 'email不能为空',
              email: 'email 格式不正确'
          <div className="form-group">
            <input className="form-control" name="required" value={this.state.require} onChange={this.setStateFromInput} />
            {this.validator.message('required', this.state.required, 'required|max:12|min:6','',{
              default: 'required不能为空',
              min: '不能少于6个字符',
              max: '不能大于12个字符'
          <button className="btn btn-primary" onClick={this.submitForm}>Submit</button>
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free