You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a lot of content on this but I'm confused π΅βπ«. The eslint rule react-hooks/exhaustive-deps throws a warning when we put nested properties from hook-returned objects into the dependency array.Β #34092
There's a lot of content on this but I'm confused π΅βπ«. The eslint rule react-hooks/exhaustive-deps throws a warning when we put nested properties from hook-returned objects into the dependency array.
One of the issues where this is described is #24300 . @gaearon wrote that the reason this is forbidden has to do with useDisclosure's return value needing to be immutable.
However, this does not make sense. In the example above: obj1 is just as mutable as obj3. And overall, I fail to see why the mutability of the enclosing object matters in the first place. In my head, it is the reference to the function onOpen that matters. The fact that I'm allowed to de-structure the value further illustrates this: