Skip to main content

useFormState

useFormState is a react hooks to subscribe form state. if form state is changed, the component using useFormState will rerender.

You can import it from fomir-react:

import { useFormState } from 'fomir-react'

Submitting Example

This is an example usage for subscribing submitting status:

Loading...
LIVE DEMO

SubmitCount Example

This is an example usage for subscribing submitCount status:

Loading...
LIVE DEMO

Form state

Form state come from form schema root node:

interface FormSchema {
submitting?: boolean
submitted?: boolean
submitCount?: number

validating?: boolean
dirty?: boolean
valid?: boolean
status?: Status

labelWidth?: number | string

[key: string]: any
}