React Stateful Forms Library.
$ npm install react-stateful-forms --save
- React Form component infrastructure.
- No redux/flux required.
- Built-in custom validation error.
import { Form, Field } from "react-stateful-forms";
render() {
...
<Form onSubmit={ this.submitMyForm } name="test_form" header="My Test Form">
<Field title="Name"
value="John Doe"
name="name"
disabled={ false }
validator={ (value) => { if (value === "John Doe") return "Please change default value"; return undefined; } }
required inputType="text" />
<Field title="Male"
value="male"
name="gender"
inputType="radio" />
<Field title="Female"
value="female"
name="gender"
inputType="radio" />
<Field title="Subscribe"
name="subscribe"
value={ false }
required
inputType="checkbox" />
</Form>
...
}