Forget useCallback and memo? React Might Just Be Getting Smarter

Forget useCallback and memo? React Might Just Be Getting Smarter

A few years ago, I remember getting genuinely excited about useCallback and useMemo. Hooks felt like this new frontier—declarative, powerful, and clean. But fast forward a couple of years, and suddenly, we’re buried in React.memo, wrapping every other function in useCallback, and debugging re-renders like it’s our full-time job.

So when I heard about React's new compiler—React Forget—I had one thought:

"Are we finally getting a break from all this manual memoization?"

Turns out the answer is yes… but not quite yet.


The Problem with Manual Memoization

Let’s be honest: memoization in React is useful but exhausting. Here’s the usual workflow:

  • You see a component re-rendering too much

  • You try wrapping it in React.memo

  • That doesn't fix it, so you useCallback the parent function

  • Then you adjust the dependency array... again

And even when it works, it’s brittle. You're one forgotten dependency or inline function away from unexpected re-renders or worse—no render when you need one.

In short, you're writing performance code just to tell React: "Trust me, nothing changed." Not exactly intuitive or enjoyable.


🤖 Enter React Compiler: Letting React Do the Work

The React Compiler, formerly codenamed React Forget, is a Babel plugin that does what developers have always wanted:

  • It analyzes your code at compile time

  • It figures out which props and functions are stable

  • It applies memoization where it's needed

You don’t need to write useMemo, useCallback or wrap components in React.memo. You just write your components, and the compiler handles the optimization behind the scenes.

Imagine writing this:

And having it act like you manually used useCallback, React.memo, and fine-tuned every render manually.

This is the promise of the React Compiler: write expressive code, get optimized performance.


But Wait… It’s Not in React 19 by Default

Here’s where most developers get tripped up.

React 19 does not include the compiler by default.

React 19 brings a lot of good things:

  • Automatic batching

  • Async transitions via useTransition

  • Better form handling with useFormStatus

  • Stream-first Suspense support

But the compiler is experimental. You need to:

  • Opt in manually

  • Use a specific Babel plugin

  • Follow some constraints (naming conventions, consistent hooks)

  • Accept that it's not production-ready yet

So if you're hoping React 19 will magically make your app faster without memoization, hold that thought.


What You Can Do Today

If you’re working with React 18 or 19, here’s a practical path forward:

  1. Use memoization intentionally. Don’t wrap every function with useCallback just to silence linter warnings.

  2. Wrap components in React.memo only if they're actually suffering from prop-driven re-renders.

  3. Profile before optimizing. React DevTools are your friend.

  4. Learn how the compiler works. Watch talks, read docs, and understand how it could change your workflow.

  5. Test it in side projects. The compiler is exciting, but keep it away from your critical production apps for now.

And most importantly, don’t optimize prematurely.

Memoization is a tool, not a requirement. It’s okay to ship without it unless profiling proves you need it.


A Bigger Mindset Shift

The React Compiler isn’t just a technical improvement—it’s a philosophical one.

We’ve been treating memoization like a manual override, telling React what to skip. But in truth, that’s a job better suited to a machine.

Let the compiler handle the math. You focus on logic, flow, and UI.

If React Forget becomes mainstream, we’re not just simplifying code—we’re removing an entire layer of complexity from the mental model of building performant apps.

That’s the real win.


Your Turn

What’s your current relationship with memoization?

  • Are you deep into useCallback and useMemo?

  • Have you tried the React Compiler yet?

  • Do you think we’ll ever fully trust the compiler to optimize for us?

Drop a comment or DM me—I’d love to hear your take.

And if this post helped clarify things, feel free to follow for more practical dev insights like this.


🧠 React may forget, but we developers still need to understand. Let’s build smarter—not just faster.

To view or add a comment, sign in

Others also viewed

Explore topics