1.4.0 • Published 6 years ago

react-formui v1.4.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

react-formui

Another approach for React Form.

NPM code style: prettier

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