Can a registration depend on its own form value? #11213
Unanswered
paulleonartcalvo
asked this question in
Q&A
Replies: 1 comment 1 reply
-
i think few things to note here
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a form which is essentially just a map of filter id's to their unique filter states. I'm using this for a data application where a user can add or delete any filters they want, so they can have between 0 (none) and
n
filters. Each filter should be able to be deleted individually.So, my approach was to do, basically, this:
Are there any risks with taking this approach? I've been encountering some odd bugs that i think may be due to some asynchronously triggered renders or maybe race conditions. Also ran into an issue where the props saved form state were being mutated when calling
unregister
(the value was removed from the props object itself). Im unsure if this is literally whats happening, or if theres just some intermediate renders occurring which somehow result in the form updating in this way, but it is bizzarre.All this to say, is there a better approach for the behavior i am trying to produce here? Should i be using field array instead? Something else?
Beta Was this translation helpful? Give feedback.
All reactions