โ† Back to list

๐Ÿš€ I accidentally fixed my React performance with one script tag

Sometimes the best performance wins come from tools you didnโ€™t plan to use.

Mateusz Bieda ยท 2026-04-03 15:33 ยท 0 claps ยท 1.2 min read
#debugging #react #reactjs #javascript #jsx
Open on Medium โ†—
Wiki topics: ๐Ÿ’ป ยท Programming ๐ŸŒ ยท Web Development

๐Ÿš€ I accidentally fixed my React performance with one script tag

Sometimes the best performance wins come from tools you didnโ€™t plan to use.

In my case, it was this one

<script src="https://cdn.jsdelivr.net/npm/react-scan/dist/auto.global.js"></script>

Yes, seriously.

๐Ÿค” The problem: โ€œWhy is everything re-rendering?โ€

I was working on a fairly standard React app โ€” tables, filters, some global state, nothing crazy.

But something felt off:

  • UI updates were sluggish
  • Components re-rendered more than expected
  • DevTools didnโ€™t clearly show why

Classic React pain.

๐Ÿ” The tool I didnโ€™t know I needed

I dropped in React Scan out of curiosity.

No config. No setup. Just a script tag.

And suddenlyโ€ฆ

๐Ÿ‘‰ My app lit up with visual indicators of re-renders.

Instead of guessing, I could now see:

  • which components re-render
  • how often they re-render
  • what triggered them

It immediately exposed issues like:

โŒ Unstable props

<MyComponent data={{ value: 1 }} />

โŒ Functions recreated on every render

onClick={() => doSomething()}

โŒ Missing memoization

const computed = heavyCalculation(data);

4. Fixing state boundaries

Big one.

I had state too high in the tree โ†’ causing cascade re-renders.

๐Ÿ‘‰ Moving state closer to where itโ€™s used reduced updates massively.

๐Ÿ“ˆ The result

After ~30 minutes of cleanup:

  • ๐Ÿ”ป Re-renders dropped significantly
  • โšก UI became noticeably faster
  • ๐Ÿง  Debugging became predictable instead of guesswork

And the best part?

๐Ÿ‘‰ No premature optimization. Only fixing real problems.

โš ๏ธ One important note

This is a debugging tool, not something you ship to production.

Use it locally or in dev environments only.


๋ฉ”ํƒ€๋ฐ์ดํ„ฐ
post_id
ec3f4d665bb4
slug
i-accidentally-fixed-my-react-performance-with-one-script-tag-ec3f4d665bb4
url
https://medium.com/@mateusz.bieda95/i-accidentally-fixed-my-react-performance-with-one-script-tag-ec3f4d665bb4
canonical_url
https://medium.com/@mateusz.bieda95/i-accidentally-fixed-my-react-performance-with-one-script-tag-ec3f4d665bb4
author_url
https://medium.com/@mateusz.bieda95
status
ok
fetched_at
2026-06-11 17:15:47