1.3.0 • Published 5 years ago

dahlia-form v1.3.0

Weekly downloads
9
License
MIT
Repository
github
Last release
5 years ago

dahlia-form

React form based on Hooks

Installation

yarn add dahlia-form

Usage

import React from 'react'
import ReactDOM from 'react-dom'
import { createForm } from 'dahlia-form'

const { Field, store } = createForm({
  initialValues: {
    email: '',
    password: '',
  },
  onSubmit: async (values, { setSubmitting }) => {
    alert(JSON.stringify(values, null, 2))
    setSubmitting(false)
  },
})

const App = () => {
  return (
    <form onSubmit={store.handleSubmit}>
      <Field name="email">
        <input type="text" />
      </Field>

      <Field name="password">
        <input type="password" />
      </Field>
      <button type="submit" disabled={store.submitting}>
        submit
      </button>
    </form>
  )
}

ReactDOM.render(<App />, document.getElementById('root'))

License

MIT License

1.3.0

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.0

5 years ago