watch rerender issue #11102
Unanswered
satinder1624
asked this question in
Q&A
Replies: 0 comments
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.
-
This is the code I am writing
{fields?.map((element, index) => {
const isChecked = watch(
${fieldPrefix}.authorizedPersons.[${index}].contactInformation.sameAsPropertyAddress
)const isAddressUnit = watch(
${fieldPrefix}.authorizedPersons.[${index}].contactInformation.address
)if (isChecked) {
setValue(
${fieldPrefix}.authorizedPersons.[${index}].contactInformation.address
, qAddress)}else {
setValue(
${fieldPrefix}.authorizedPersons.[${index}].contactInformation.address
, address)}
return (
// code here
)
}
I am getting a infinte loop issue because address is keep updating. Why?
because in if else conditions I am setting address and I am watching it in the same area
Beta Was this translation helpful? Give feedback.
All reactions