Pass field as prop to FieldArray
See original GitHub issueBug, Feature, or Question?
Question / Feature
Current Behavior
Currently the <FieldArray />
gets only the arrayHelpers
and form
passed in as prop. Is there any reason it does not get the field property passed in? Now I have to get the values ‘manually’ from the form prop.
Desired Behavior
It would be nice to get at least the value
from the field (based on the field name).
Suggested Solutions
Passing a similar field
prop as the <Field />
component receives, except for the onChange
and onBlur
.
- Formik Version: 0.11.0-beta.1
- OS: Mac OS High Sierra
- Node Version: 9.3.0
- Package Manager and version: 1.3.2
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Passing extra props to component wrapped in FieldArray ...
What I would like to be able to do is to pass a dictionary to 'emails' in order to populate the 'content' field...
Read more >FieldArray - Redux Form
The FieldArray component is how you render an array of fields. ... Object with custom props to pass through the FieldArray component into...
Read more ><FieldArray /> | Formik
<FieldArray /> is a component that helps with common array/list manipulations. You pass it a name property with the path to the key...
Read more >useFieldArray - Simple React forms validation
Whether Field Array will be unregistered after unmount. keyName, string = id. Name of the attribute with autogenerated identifier to use as the...
Read more >FieldArray | Vue Advanced Forms - GitHub Pages
A field's array name the internal form state. # component. A field wrapper component. Default span . # validation. The prop to pass...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
+1
It would be nice also for extra props to be passed down the component:
See https://codesandbox.io/s/6y8q0ql34z
In the current state,
shouldBePassed
will not be passed down to the rendered component.Also got confused by the fact that rest props are not passed to
<FieldArray/>
component. It would be nice to allow it.At the same time workaround will look like this: