React Hooks to bind to š Final Form's high performance subscription-based form state management engine
npm install react-final-form-hooks  




ā Zero dependencies
ā
Only peer dependencies: React and
š Final Form
ā Opt-in subscriptions - only update on the state you need!
ā š„ 1.2 kB gzipped š„
---
``bash`
npm install --save react-final-form-hooks final-form
or
`bash`
yarn add react-final-form-hooks final-form
š React Final Form Hooks is the leanest possible way to connect š Final Form to React, to acheive subscriptions-based form state management using the Observer pattern.
#### ā ļø This library will re-render your entire form on every state change, _as you type_. ā ļø
If performance is your goal, you are recommended to use š React Final Form. Also, that library does many other things for you, like managing checkbox and radio buttons properly. RFFHooks leaves all of that work to you. By default, š React Final Form Hooks subscribes to _all_ changes, but if you want to fine tune your form, you may specify only the form state that you care about for rendering your gorgeous UI.
Here's what it looks like in your code:
`jsx
import { useForm, useField } from 'react-final-form-hooks'
const MyForm = () => {
const { form, handleSubmit, values, pristine, submitting } = useForm({
onSubmit, // the function to call with your form values upon valid submit
validate // a record-level validation function to check all form values
})
const firstName = useField('firstName', form)
const lastName = useField('lastName', form)
return (
Table of Contents
react-final-form-hooks and the hooks introduced in react-final-form v5?
- Examples
- Simple Example
- API
- useField
- name : string
- form : Form
- validate? : (value:any) => any
- subscription? : FieldSubscription
- useForm
- onSubmit : (values:Object) => ?Object | Promise | void
- validate?: (values:Object) => Object | Promise