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
Click on "Remove 0 (same useFieldArray WORKS)". Observe the 0th element in the list be removed
Click on "Remove 0(separate useFieldArray DOES NOT WORK)". Observer nothing is removed from the list
Expected behaviour
I would expect any instance of useFieldArray referencing the same list to be able to modify said list.
What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
bolencki13
changed the title
issue: Two useFieldArray are not able to modify the same array
issue: Two useFieldArray instances are not able to modify the same array
Jun 5, 2024
This seems like a bit of a design flaw. One of the benefits of a context is to prevent passing props down the chain. While in the minimal example above it might make sense to pass this instance around, in a more complex real world example it seems like an anti-pattern having to create an instance top level and pass it down multiple branches various levels.
I'd like to understand the design choice, is there a particular reason for this requirement?
Version Number
7.51.5
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/divine-shape-4s2zy9
Steps to reproduce
Expected behaviour
I would expect any instance of useFieldArray referencing the same list to be able to modify said list.
What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: