reforms
v0.8.1
Published
Forms and React made easy
Downloads
6
Readme
reforms
React forms made easy.
Benefits
- Ease of use.
- Best of both worlds (React and Javascript).
Form
object to populate the form, get the values afterwards- React components to render the form.
- Extensible
- Easy to define new Input types.
Usage
npm install --save reforms
import {Form, Input} from 'reforms';
import React from 'react';
class MyForm extends React.Component {
constructor(args) {
super(args);
this.form = new Form;
}
render() {
let form = this.form;
return <form.render>
<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.render>
}
}