Logo

My React App Seemed Fine — Until I Scanned It

A comprehensive guide on using react-scan to uncover and fix performance issues in React applications

Salman Khan

3/19/2024 · 2 min read

React Performance Scanning

As a React developer with over 5 years of experience, I’ve always made performance a priority. My components were optimized. There were no console errors or warnings. Lighthouse even gave me a score of 92.

Still, I kept facing issues:

  • ❌ Slow initial load times
  • ❌ Inconsistent re-renders
  • ❌ Feedback from users: “It feels a bit laggy…”

So one evening, I decided to try a tool I hadn’t used before:

npx react-scan .

react-scan — a CLI tool that uncovers real React performance issues. It detects:

  • ✅ Unnecessary re-renders
  • ✅ Incorrect usage of memo, useCallback, and useMemo
  • ✅ Leaky or redundant props
  • ✅ Subtle anti-patterns most linters miss

To my surprise, it found 12 genuine performance flaws I had completely overlooked.

What I Fixed:

  • 4 props that were breaking memoization
  • 3 objects recreated on every render
  • 1 useEffect missing a dependency
  • 2 unused useCallback functions
  • 1 rogue console.log running 80 times per second 😅

💡 5 Practical Tips to Improve React Performance

  1. Avoid inline arrow functions in props Use useCallback to reduce unnecessary re-renders.

  2. Virtualize large lists Libraries like react-window help maintain a healthy DOM.

  3. Don’t overuse React.memo Memoization isn’t always the solution — use it thoughtfully.

  4. Use useMemo for stable object references Prevents re-renders in children caused by shallow comparison.

  5. Split large components into smaller ones Smaller components are faster, cleaner, and easier to test.

🚀 Get Started

Install the tool globally:

npm install -g react-scan

Then run it:

react-scan .

No configuration needed — just actionable results.

Final Thought

Assuming your app is fast isn’t enough. Measure it. Prove it.

This tool gave me a new perspective on performance. Try it once — if it finds nothing, send me a message. I’ll buy you a coffee ☕.

#ReactJS #Performance #DevTools #ReactScan #WebDev #FrontendTips #CodeQuality #CleanCode #Debugging