Types

Decorator


Decorator

(form: FormApi) => Unsubscribe

Decorator is a function that decorates a form by subscribing to it and making changes as the form state changes, and returns an Unsubscribe function to detach itself from the form. e.g. Final Form Calculate.

Related:

Example Usage

import { createForm } from 'final-form'

// Create Form
const form = createForm({ onSubmit })

// Decorate form
const undecorate = decorator(form)

// Use form as normal

// Clean up
undecorate()