Have an issue, but can't tell what line is causing the bug


Have an issue, but can't tell what line is causing the bug?

Bisect.

Here's how:

1. Comment out half the code. Still there?
2. Continue commenting out half the remaining code until the issue goes away.
3. Add small pieces back until the issue returns.

Bug found. 🤓
I'm using this pattern now to hunt down a reusable React component that's dragging along its own copy of react-dom. I imported half the reusable library to see if that half had the issue. This helped me zero in on the bad component.

View original on X