( componentName?: string, )
| 3 | import ReactFinalFormContext from "./context"; |
| 4 | |
| 5 | function useForm<FormValues = Record<string, any>>( |
| 6 | componentName?: string, |
| 7 | ): FormApi<FormValues> { |
| 8 | const form: FormApi<FormValues> | undefined = React.useContext( |
| 9 | ReactFinalFormContext, |
| 10 | ); |
| 11 | if (!form) { |
| 12 | throw new Error( |
| 13 | `${componentName || "useForm"} must be used inside of a <Form> component`, |
| 14 | ); |
| 15 | } |
| 16 | return form; |
| 17 | } |
| 18 | |
| 19 | export default useForm; |
no outgoing calls
searching dependent graphs…