How to fix issues
React Doctor diagnostics point to specific files, lines, rules, and recommendations.
Start with the highest-severity issues, then work down.
Recommended workflow
-
Run a diff scan:
npx react-doctor@latest --verbose --diff -
Fix
errordiagnostics first. -
Re-run the same command.
-
Fix warnings that represent real product or maintainability risk.
-
Suppress only when the code is intentionally unusual.
Understand a diagnostic
Use --explain when a rule is confusing or a suppression is not working:
npx react-doctor@latest --explain src/App.tsx:42The alias --why works too:
npx react-doctor@latest --why src/App.tsx:42Suppress only when needed
Prefer fixing the root cause. When a suppression is appropriate, keep it narrow:
// react-doctor-disable-next-line react-doctor/no-derived-state-effect
useEffect(() => {
setValue(expensiveInitialValue);
}, []);Use comma-separated rule names for multiple suppressions on one line.