1.0.2 • Published 8 years ago

react-automatic-form v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

React Automatic Form

React component that generates a form from an array of fields you'd like to include. Includes simple validation and callback to parent component passing back an object with the form data. Only supports input tags currently.

Usage

class Example extends React.Component {
  constructor(props) {
    super(props)
  }
  handleSubmit (formData){
    console.log(formData)
  }
  render() {
    const inputFields = [
      {
        name: 'name',
        type: 'text'
      },
      {
        name: 'email',
        type: 'email'
      },
      {
        name: 'color',
        type: 'text'
      }
    ]
    return (
      <AutomaticForm inputs={inputFields}
                     callBack={this.handleSubmit.bind(this)}
                     />
        )
  }
}

License

MIT