I keep getting the ESLint error for this, I’m not sure how to refactor this as I don’t want to lose the existing defined variables as they are being used in different places across the app.
const dogArray
[{
{
title: 'How old is the dog?',
value: DogAgeValue,
},
}]
let newDogArray = [];
if (!dog?.editDogForm && dogValue?.value === 'lab') {
newDogArray = [
...dogArray,
{
title: 'what breed is the dog?',
value: whoWalksDogValue,
},
]
} else {
newDogArray = [...dogArray];
}
return newDogArray;
To be clear these are dummy values just to show what I’m working with. The original array has more fields inside it.