react-formui
v1.4.0
Published
Another approach for React Form
Downloads
2
Readme
react-formui
Another approach for React Form.
Features
Install
yarn add react-formui
Usage
import React, { Fragment } from 'react'
import Form from 'react-formui'
const fields = {
firstName: 'Khalil',
lastName: {
value: 'Zhang',
parser: v => v,
formatter: v => v,
rules: 'required|min:2|max:10',
},
}
export default () => (
<Form fields={fields}>
{({ Field, TextInput, changed }) => (
<Fragment>
<Field name="firstName" component={TextInput} />
<Field name="lastName" component={TextInput} />
<button disabled={!changed}>提交</button>
</Fragment>
)}
</Form>
)
License
MIT © starandtina