You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/react-renderer-demo/src/app/pages/renderer/field-provider.md
+55-31Lines changed: 55 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,47 +9,27 @@ import ListOfContents from '../../src/helpers/list-of-contents';
9
9
<Gridcontaineritem>
10
10
<Griditemxs={12}md={10}>
11
11
12
-
# Field Provider
13
-
14
-
## Custom components
12
+
# Custom components
15
13
16
14
React form renderer is using [react-final-form](https://github.com/final-form/react-final-form) for form state management.
17
15
Most of its features are not directly available for consistency and performance reasons. If you want to create any custom
18
-
components, you can access these features via `FieldProvider`prop.
16
+
components, you can access these features via `FieldProvider`component or `useFieldApi` hook.
19
17
20
-
FieldProvider is a wrapper component around standard
21
-
[react-final-form Field component](https://final-form.org/docs/react-final-form/api/Field)
22
-
which adds additional methods that will help you to control your form state.
18
+
`FieldProvider` is a wrapper using `useFieldApi` to get the access to the form state.
23
19
24
-
# Accessing FieldProvider
20
+
`useFieldApi` is a wrapper around [React Final Form useField hook](https://final-form.org/docs/react-final-form/api/useField).
25
21
26
-
To use Fieldprovider, you first need to register a component to your component mapper.
27
22
You can read more about that in <RouterNavhref="/renderer/component-mapping"><Linkhref="/renderer/component-mapping">Component mapping</Link></RouterNav>.
28
23
29
-
Each component will receive FieldProvider as a prop. Be aware that pre-defined component types are
30
-
automatically wrapped in FieldProvider. This is done to make it easier to create component mappers for
31
-
standard form components. List of standard components is available <RouterNavhref="/renderer/component-api"><Linkhref="/renderer/component-api">here</Link></RouterNav>.
32
-
33
-
# Using FieldProvider
34
-
35
-
## Register component
36
-
37
-
```jsx
38
-
importNewComponentfrom'./new-component'
39
-
40
-
constcomponentMapper= {
41
-
'new-component': NewComponent
42
-
}
43
-
```
44
-
45
24
## Implementation of component
46
25
47
26
Next example shows simple input field with label and error message.
Every component also receives component `FormSpyProvider` as a prop. You can find more info <ahref="https://final-form.org/docs/react-final-form/api/FormSpy"rel="noopener noreferrer"target="_blank">here!</a>
137
+
[React Final Form Array](https://github.com/final-form/react-final-form-arrays) is exported via Data Driven Forms.
0 commit comments