-
When changing Controller name dynamically, the Controller triggers its input re-render where I got an example proof on CodeSandbox
Thoughts? Do you think this might be a bug or expected behavior? |
Beta Was this translation helpful? Give feedback.
Answered by
Moshyfawn
Mar 7, 2024
Replies: 2 comments 1 reply
-
See this FAQ for an explanation. <Controller
+ key={currentName}
control={methods.control}
name={currentName}
render={({ field: { value, name } }) => {
console.log(`value for ${name}`, value);
}}
/> |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ggat
-
Is there any downside in generally passing the field name as a key for every field in the whole application? |
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
See this FAQ for an explanation.
<Controller + key={currentName} control={methods.control} name={currentName} render={({ field: { value, name } }) => { console.log(`value for ${name}`, value); }} />