Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Nested Field Arrays within a Field Array #73

Open
shivan-s opened this issue Mar 23, 2023 · 3 comments
Open

[Feature Request]: Nested Field Arrays within a Field Array #73

shivan-s opened this issue Mar 23, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@shivan-s
Copy link
Contributor

Description

I am wondering if there is an implementation of nested field arrays within a nested field array.

Take this pseudo code for instance:

<FieldArray>
  {({value, add, remove}) => {
    <FieldArrayItem>
    {/* some field */}
    </FieldArrayItem>
    <FieldArrayItem>
      {({value, setValue}) => {
        <FieldArray>
          {/* another field array */}
        </FieldArray>
    }
    </FieldArrayItem>
   }
</FieldArray>

Hope this makes sense. What makes it tricky is linking the setValue to the outer nest. I'm wondering if there is an implementation already.

Let me know if the example needs to be fleshed out more.

Thanks in advance.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

@shivan-s shivan-s added enhancement New feature or request needs triage Needs attention from the HouseForm maintainers labels Mar 23, 2023
@shivan-s
Copy link
Contributor Author

A simple workaround for this is within the name prop of the <FieldArrayItem>, simply add parent[${i}].child[${j}].subchild.

@crutchcorn crutchcorn removed the needs triage Needs attention from the HouseForm maintainers label Mar 24, 2023
@crutchcorn
Copy link
Member

Hmm yeah, this makes sense. How would you go about solving this? Like, what would you want the API to look like?

@shivan-s
Copy link
Contributor Author

Hey @crutchcorn, I think the current implementation is fine. Would you think this would be useful to add to the docs? I can help if you would like.

Nested arrays within arrays would be common I would think.

Let me know what you think :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants