Not every warning in your project is caused by the code you wrote.
A few days ago, I kept seeing this warning in the console: "Unable to preventDefault inside passive event listener invocation."

I was working on an Instagram-style Stories feature with images, videos, tap navigation, and press-and-hold to pause. The feature itself was working fine, but the warning appeared almost every time I tapped on mobile.
My first thought was obvious: where did I mess up? I checked the stack trace, and it turned out the issue was not in my code at all. It was coming from react-insta-stories. The library was calling e.preventDefault() directly inside a touch event.
The problem was that the event was running through a passive listener, which meant it was not always cancelable. So the browser kept throwing the warning. The fix was simple: if (e.cancelable) e.preventDefault(); — one line, and the warning was gone without changing the behavior.
The main takeaway for me: not every warning in your project is caused by the code you wrote. Sometimes, reading the stack trace carefully can save you from spending hours fixing the wrong thing. I reported the issue upstream, because there is a good chance another developer will run into the exact same problem.
Original publication (external website)