How to fix linter error in useEffect

I was declaring a new variable with a default assignment of an empty object, yes the contents are changing while the reference stays the same and that is what I was trying to do.

declaring a response object and filling it with parameters inside the function body and returning it is a pretty normal occurance is it not?

function multiply(a, b = 1) {
  return a * b;


the above is acceptable, but doing the same with an object is wrong, other than that you can declare it as a constant why its that much different, so what if its mutated? it is only exisiting inside of that small scope. please provide an example of why its an anti-pattern

True, your code doesnt have the linter error, but it is running the effect twice, it’s producing the same result for me that I was getting before with the code I wrote. (Im running react 18)

This thread has my work, if you want to check it out, I appreciate your helpful advice: