MCPcopy
hub / github.com/final-form/react-final-form / useForm

Function useForm

src/useForm.ts:5–17  ·  view source on GitHub ↗
(
  componentName?: string,
)

Source from the content-addressed store, hash-verified

3import ReactFinalFormContext from "./context";
4
5function 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
19export default useForm;

Callers 6

FormSpyFunction · 0.85
useFieldFunction · 0.85
useFormStateFunction · 0.85
MyFormConsumerFunction · 0.85
useKeywordFunction · 0.85
PercentCompleteFunction · 0.85

Calls

no outgoing calls

Tested by 1

MyFormConsumerFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…