0.1.18 • Published 6 years ago

reactjs-form v0.1.18

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

ReactJS-Form


NPM Version NPM Downloads Build Status codecov.io

reactjs-form is a react library that allows html form validation within component state using minimal code and declarative way, our validator uses skaterdav85/validatorjs package that inspired by Laravel PHP Validator

Example

import React, {Component} from 'react'
import Form from 'reactjs-form'
import TextInput from '../../components/text-input'

class SingleInput extends Component {
  constructor(props) {
    super(props)
    this.onSubmit = this.onSubmit.bind(this)
  }
  render() {
    const {
      inputComponent:Input,
      submitting
    } = this.props
    return (
      <form onSubmit={this.onSubmit}>
        <Input
          name="email"
          type="email"
          label="Email Address"
          component={TextInput}
        /> 
      </form>
    )
  }
  onSubmit(e) {
    e.preventDefault()
    this.props.validate().then(() => {
      // continue
    }).catch(() => {})
  }
}

export default Form(SingleInput, { 
  rules: {
    email: "required|email"
  }
})

Installation

npm install --save reactjs-form or yarn add reactjs-form

Docs

Check out the Documentation

Demo

npm run examples or yarn examples

0.1.18

6 years ago

0.1.17

6 years ago

0.1.16

6 years ago

0.1.15

6 years ago

0.1.12

6 years ago

0.1.9

6 years ago

0.1.7

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago