React 19.2 useEffectEvent: Why It Won't Fix Your Deps Array
javascript
dev.to
Your chat room component reconnects every time someone flips the dark-mode switch. Messages in flight get dropped, the "typing…" indicator resets, and support tickets call it "random." The bug isn't the dark-mode toggle — it's that theme is sitting in a useEffect dependency array next to roomId, and React has no way to know that only one of those two values should actually restart the connection. The reflex fix — deleting theme from the array and silencing the lint warning — trades one bug for