0.2.4 • Published 8 years ago
easy-forms v0.2.4
EasyForm
Forms and React made easy.
Benefits
- Ease of use.
- Best of both worlds (React and Javascript).
Form
object to popular the form, get the values afterwards- React components to render the form.
- Extensible
- Easy to define new Input types.
Usage
npm install --save easy-forms
import {Form, Input} from 'easy-forms';
import React from 'react';
class MyForm extends React.Component {
constructor(args) {
super(args);
this.form = new Form;
}
render() {
let form = this.form;
return <form.Container>
<div className="form-group">
<label>E-mail</label>
<Input type="email" className="form-control" name="email" placeholder="E-mail address" />
</div>
<div className="form-group">
<label>Password</label>
<Input type="password" className="form-control" name="password" placeholder="Password" />
</div>
<button onClick={e => {
console.error('submit form with values', form.getValues())
}} className="btn btn-default">Submit</button>
</form.Container>
}
}