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

Function FieldComponent

src/Field.tsx:6–100  ·  view source on GitHub ↗
(
  {
    afterSubmit,
    allowNull,
    beforeSubmit,
    children,
    component,
    data,
    defaultValue,
    format,
    formatOnBlur,
    initialValue,
    input,
    isEqual,
    multiple,
    name,
    parse,
    subscription,
    type,
    validate,
    validateFields,
    value,
    ...rest
  }: FieldProps<FieldValue, T, FormValues>,
  ref: React.Ref<T>,
)

Source from the content-addressed store, hash-verified

4import useField from "./useField";
5
6function FieldComponent<
7 FieldValue = any,
8 T extends HTMLElement = HTMLElement,
9 FormValues = Record<string, any>,
10>(
11 {
12 afterSubmit,
13 allowNull,
14 beforeSubmit,
15 children,
16 component,
17 data,
18 defaultValue,
19 format,
20 formatOnBlur,
21 initialValue,
22 input,
23 isEqual,
24 multiple,
25 name,
26 parse,
27 subscription,
28 type,
29 validate,
30 validateFields,
31 value,
32 ...rest
33 }: FieldProps<FieldValue, T, FormValues>,
34 ref: React.Ref<T>,
35) {
36 const field: FieldRenderProps<FieldValue, T> = useField(name, {
37 afterSubmit,
38 allowNull,
39 beforeSubmit,
40 component,
41 data,
42 defaultValue,
43 format,
44 formatOnBlur,
45 initialValue,
46 isEqual,
47 multiple,
48 parse,
49 subscription,
50 type,
51 validate,
52 validateFields,
53 value,
54 });
55
56 // Merge provided input prop with field.input
57 const mergedField = input
58 ? { ...field, input: { ...field.input, ...input } }
59 : field;
60
61 if (typeof children === "function") {
62 return (
63 children as (

Callers

nothing calls this directly

Calls 2

useFieldFunction · 0.85
renderComponentFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…