Get id of new FieldArray item immediately after append #12014
Unanswered
BrendanC23
asked this question in
Q&A
Replies: 1 comment
-
You can either do
or
and when you render fields check if |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I have a field array and state that represents the item that is currently selected. When I append a new item, I would like to set the selected item to the new item. However,
fieldArray.append()
does not take effect until the next render and does not return the new id.Here's an example:
I could do something like
but this triggers when a field is deleted and doesn't work for methods other than append (
prepend()
orinsert
).Beta Was this translation helpful? Give feedback.
All reactions