React Performance Optimization: From Slow to Lightning Fast

Published: (February 21, 2026 at 03:57 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

Profile First — Don’t Guess

Use the React DevTools Profiler to find the actual bottleneck:

  1. Open the Profiler tab.
  2. Record an interaction.
  3. Examine which components re‑rendered and why.

Memoization

Component Memoization

import { memo } from "react";

const ExpensiveChart = memo(function ExpensiveChart({
  data,
  width,
  height,
}: ChartProps) {
  // Only re‑renders when props actually change
  return ;
});

Value Memoization

import { useMemo } from "react";

const summary = useMemo(() => ({
  total: transactions.reduce((sum, t) => sum + t.amount, 0),
  byCategory: groupBy(transactions, "category"),
}), [transactions]);

Note: React 19 introduces automatic memoization at build time, making manual memo/useMemo/useCallback largely unnecessary for new code. Enable it with the experimental compiler flag: { reactCompiler: true }.

Code Splitting & Lazy Loading

import { lazy, Suspense } from "react";

const DataViz = lazy(() => import("./DataVisualization"));

function Dashboard() {
  return (
    }>
      
    
  );
}

Virtualize Long Lists

Render only visible items. For lists with 100+ items, use @tanstack/react-virtual. The overhead of the virtualizer is negligible compared to rendering thousands of DOM nodes.

State Management

The most impactful technique is to put state as close as possible to where it’s used. Frequently changing global state forces the entire tree to re‑render.

Additional Optimizations

  • Code‑split heavy routes to reduce initial bundle size.
  • Optimize images with next/image or lazy loading.
  • Defer non‑urgent updates using useDeferredValue.
  • Enable the React Compiler (React 19) for automatic optimizations.
  • Focus on architecture (where state lives, how data flows) rather than micro‑optimizations; a well‑structured app is fast by default.

Quick Checklist

  • Profile first — don’t guess.
  • Co‑locate state — move it down the tree.
  • Virtualize long lists (100+ items).
  • Code‑split heavy routes.
  • Optimize images (next/image or lazy loading).
  • Defer non‑urgent updates (useDeferredValue).
  • Enable React Compiler in React 19.
  • Prioritize architecture over micro‑optimizations.

Explore 85+ free developer tools or support this work.

0 views
Back to Blog

Related posts

Read more »

How We Made Our E2E Tests 12x Faster

!Alex Neamtuhttps://media2.dev.to/dynamic/image/width=50,height=50,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2F...