Back to Resources
React Compiler: The End of useMemo and useCallback
DevelopmentFeatured
#React#React Compiler#React 19#useMemo#useCallback#Frontend Performance#Web Development 2026#JavaScript#Optimization#React Forget#Virtual DOM#State Management#Developer Experience#React Hook#how to optimize react performance#what is react compiler#react forget tutorial#do I need usememo anymore#react 19 features#react rendering optimization

React Compiler: The End of useMemo and useCallback

Discover how the new React Compiler automatically optimizes your React applications. Say goodbye to manual memoization with useMemo and useCallback, and write cleaner, more intuitive React code.

CreatedJune 25, 2026
UpdatedJune 25, 2026
Access Tool

For years, React developers have navigated the complexities of manual performance optimization. We wrapped functions in useCallback, wrapped heavy calculations in useMemo, and sometimes wrapped entire components in React.memo to prevent unnecessary re-renders.

This manual process often led to confusing dependency arrays, stale closures, and a degraded developer experience. However, with the introduction of the React Compiler (originally known as React Forget), the era of manual memoization is coming to a close.

What is the React Compiler?

The React Compiler is an advanced build-time tool that analyzes your React components and hooks, automatically applying optimizations that you would otherwise have to write by hand.

By deeply understanding JavaScript and React's rules, the compiler can determine exactly which parts of a component need to be recalculated when state or props change, and which parts can be safely cached.

How it Changes Your Code

Before the compiler, a common pattern to optimize a child component and an expensive calculation looked like this:

import { useMemo, useCallback } from 'react';

function Dashboard({ data, onFilter }) {
  // Manual memoization to prevent recalculation on every render
  const processedData = useMemo(() => {
    return expensiveDataProcessing(data);
  }, [data]);

  // Manual memoization to maintain function identity
  const handleItemClick = useCallback((id) => {
    onFilter(id);
  }, [onFilter]);

  return <DataGrid items={processedData} onClick={handleItemClick} />;
}

With the React Compiler, you write standard, straightforward JavaScript:

function Dashboard({ data, onFilter }) {
  // No useMemo needed
  const processedData = expensiveDataProcessing(data);

  // No useCallback needed
  const handleItemClick = (id) => {
    onFilter(id);
  };

  return <DataGrid items={processedData} onClick={handleItemClick} />;
}

The compiler will automatically transform the second block into highly optimized code that performs just as well (if not better) than the manually memoized version.

The Impact on Developer Experience (DX)

  1. Reduced Cognitive Load: Developers no longer need to constantly ask, "Should I memoize this?" or debug missing dependencies in the useEffect/useMemo arrays.
  2. Cleaner Codebases: Code becomes purely about business logic and rendering UI, free of optimization boilerplate.
  3. Fewer Bugs: The compiler understands React's rendering lifecycle perfectly, eliminating human errors related to stale closures or missing dependency array items.

Preparing for the Future

The React Compiler expects your code to follow React's core rules (e.g., components must be pure functions, mutations during render are forbidden). As long as you adhere to standard React patterns and avoid side-effects inside render phases, your codebase is ready for the compiler.

Embrace the simplicity. Write your components naturally and let the compiler handle the performance.