question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pass props through FieldArray

See original GitHub issue

Feature

I have a view component for rendering an array of fields.

function createFormikArray({ title, initialValue }, renderItem) {
  return function FormikArray({ name, form, ...arrayHepers }) {
    return (
      <React.Fragment>
        {/* view that uses title, initialValue and renderItem props */}
      </React.Fragment>
  }
}

It would be very useful if I could do smth like that:

<FieldArray
  name='users'
  component={FormikArray} 
  title='My Field' 
  initialValue={{ firstname: '', lastname: '' }}
  {/* and so on */}
/>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:11
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

11reactions
cdpautschcommented, Dec 18, 2019

Any update on this? This is a feature that would be useful. We are passing a custom component to FieldArray, and passing props via FieldArray to our custom component allows us to adjust what renders. I see there’s an outstanding PR for it, but it hasn’t been updated since March.

0reactions
plxelcommented, Nov 19, 2018

Also Field component passes props to underlying field Component

<Field
    component="textarea"
    name={`somename.${index}`}
    className="style"
    placeholder="placeholder"
/>

So I thought this will be ok for using the same logic for FieldArray, but it is not… it is really confusing

Read more comments on GitHub >

github_iconTop Results From Across the Web

Passing extra props to component wrapped in FieldArray ...
When you create functional component with react your component accepts props as an argument. For example this piece of code is:
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 >
FieldArray - Redux Form
These are props that FieldArray will pass to your wrapped component. All the props provided to your component by redux-form are divided into...
Read more >
React Formik Tutorial - 22 - FieldArray component - YouTube
React Formik Tutorial - 22 - FieldArray component ... Business - codevolution.business@gmail.com FieldArray component with Formik in React ...
Read more >
FieldArrayRenderProps - React Form Component - Telerik
FieldArrayRenderProps. Represents the props that are passed to the component which is rendered by FieldArray. Name, Type, Default, Description ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found