· 6 min read · Hexain Technologies
Optimizing Performance in React Apps
A tactical guide to profiling, code-splitting, and squeezing performance wins in large-scale SPAs.
Most React performance problems are not React problems. They are oversized images, a 400 KB bundle loaded before anything renders, and content that only exists after JavaScript runs. Fix those three first and the framework-level tricks become mostly unnecessary. Here is the order we follow on every audit.
1. Measure before touching code
Run Lighthouse on a throttled mobile profile and look at the three Core Web Vitals: Largest Contentful Paint (LCP), Interaction to Next Paint (INP) and Cumulative Layout Shift (CLS). Then open the Performance panel and record a page load. The flame chart tells you whether the time goes to downloading, parsing JavaScript, rendering or layout. Guessing wastes days; a ten-minute recording rarely lies.
2. Images are usually the biggest win
A marketing site we audited recently shipped portfolio screenshots at 2,940 pixels wide and displayed them at 338. Converting to WebP and resizing cut the page from 9 MB to under 1 MB with no visible difference. Add explicit width and height attributes so the browser reserves space (this is what fixes CLS), and loading="lazy" for anything below the fold.
3. Ship less JavaScript up front
Code-split by route with React.lazy and a Suspense boundary, so the contact page does not pay for the animation library used on the home page. Check your bundle with vite-bundle-visualizer or source-map-explorer; the usual offenders are icon packs imported wholesale, moment.js, and charting libraries loaded on pages without charts.
4. Render HTML on the server or at build time
A single-page app serves an empty <div id="root"> and builds the page in the browser. Search engines and link previews see nothing until that happens. For content sites, pre-render each route at build time (Vite SSG, Next.js static export, Astro) so the HTML already contains the text, then hydrate. First paint gets faster and crawlers get real content.
5. Only then reach for memoisation
useMemo, useCallback and React.memo help when a component re-renders expensively and often. The React DevTools Profiler shows exactly which components those are; apply memoisation there, not everywhere. Blanket memoisation adds complexity and often makes things slower.
6. Watch the long lists and the effects
Virtualise lists over a few hundred rows with react-window. Audit useEffect hooks that run on every render or subscribe to scroll and wheel events without throttling; these are the most common cause of poor INP in the apps we review.
A checklist you can run today
Compress and resize images; add dimensions; lazy-load below the fold; split by route; pre-render public pages; profile before memoising; virtualise long lists. Doing these in order typically takes a mid-sized React app from a mobile Lighthouse score in the 40s to the 90s without a rewrite.
