React Performance
ExpertReact.memo, useMemo, useCallback, virtualization, code splitting, Profiler, Web Vitals & bundle optimization
The Golden Rule of React Optimization
Don't optimize prematurely. Measure first with React DevTools Profiler and browser performance tools. Most apps are fast enough without optimization. The three main categories: reduce renders (memo/useCallback), reduce work per render (useMemo), and reduce bundle size (code splitting).React.memo β Skip Re-renders of Unchanged Components
intermediatememo() wraps a component so it only re-renders if its props change. Pair with useCallback to stabilize function props.
useMemo β Memoize Expensive Calculations
intermediateCache the result of an expensive computation between renders. Only recompute when dependencies change. Don't overuse β the comparison itself has a cost.
useTransition & useDeferredValue β Concurrent Mode
advancedMark state updates as non-urgent so React can interrupt them to handle urgent updates (typing, clicking). Keeps UI responsive during heavy re-renders.
Code Splitting β lazy() & Suspense
intermediateDynamically import components to split your bundle. React.lazy() + Suspense enables route-level and component-level splitting with zero boilerplate.
Virtualization β Render Only Visible Items
advancedFor large lists (1,000+ items), only render what's visible in the viewport. Use TanStack Virtual (formerly react-virtual) for best-in-class virtualization.
React Profiler & Web Vitals
expertUse React DevTools Profiler to identify slow renders. Monitor Core Web Vitals (LCP, FID, CLS) to measure real-world performance.