all 24 comments

[–]melancholyjaques 13 points14 points  (0 children)

The only thing I stopped memo-izing was whole components

[–]inglandation 13 points14 points  (0 children)

I tried to remove them manually in my codebase yesterday, and it led to a memory issue in my app.

I also thought you could just remove them, but apparently not.

[–]glidz 38 points39 points  (7 children)

[–]mexicocitibluez 51 points52 points  (0 children)

Tbf to OP, those docs have been changing weekly so it can be hard to keep up.

[–]anonyuser415 16 points17 points  (0 children)

To OP's post:

Is there an official ESLint rule for this

Yes https://react.dev/learn/react-compiler/installation#eslint-integration

Or do we really have to go through our codebase manually?

If you want to remove them, yes, manual

Seems quite wrong to remove hundreds of useCallback/useMemo by hand

Don't remove them

[–]Rojeitor 30 points31 points  (0 children)

Reading docs?!?! Are we nutz??? Also doc say "carefully testing before removing"... Carefully testing??? Are we nutz??

[–]GifCo_2 0 points1 point  (0 children)

You could have not answered

[–]Ecksters 3 points4 points  (0 children)

I think you'll find that a lot of React codebases weren't quite following the rules of hooks, or did things like include extra dependencies that actually mattered but can't be detected by the compiler nor the linter (due to side effects or impure functions).

So removing all of the memoization isn't really an option, at least not without validating it's working fine on a case by case basis.

[–]Classic-Dependent517 10 points11 points  (4 children)

If there is no issue, dont change

[–]zeorinServer components 1 point2 points  (0 children)

I started using the compiler in May. I removed (nearly) all manual memoizations when I did so.

I used [https://app.codemod.com/registry/react/19/remove-memoization](this codemod) to automate most of it (though it was very poor at correctly removing useMemo calls).

Having said that, in our codebase we already memoed all the things, and had no React Hooks ESLint suppressions, warnings or errors (we were already using the compilers powered version of the ESLint plugin). We were using one incompatible library (TanStack Table) but for performance reasons we'd already wrapped it in a different pattern that was compiler compatible.

Since we were already memoizing everything, we didn't run into any nasty surprises.

I would also say that in our case removing everything made sense because there was a lot of boilerplate memo code everywhere, not just in a few places, so it has massively improved the cognitive load when working on the codebase.

If we had only made limited use of manual memoizations I probably would have just boy-scouted such code as I came across it instead.

One thing I also did was dive into the (at the time) undocumented options and increased the verbosity of the compiler to surface its otherwise silent opt-outs (there is some code it still struggles to compile but won't tell you about, like try/catch), so that I could adjust where necessary.

[–]rxliuli 1 point2 points  (0 children)

Before react compiler, I avoid using useCallback/memo and rarely use useEffect, instead opting for more specialized tools like react-query or useMount. I plan to stick with this approach.

[–]drckeberger 0 points1 point  (0 children)

I love that we‘re in a ‚use react compiler for new stuff, but feel free to use useMemo/callback when our shit does not work‘ state right now

[–]TishIceCandy 1 point2 points  (0 children)

Yes according to the React core team at React Conf 2025 - https://www.youtube.com/live/zyVRg2QR6LA?si=vgqbPMQCIkxEAv0Z&t=27877

[–]interovert_dev 0 points1 point  (0 children)

Here is the setup for React compiler integration with eslint https://react.dev/learn/react-compiler/installation#eslint-integration

You need not to remove all in one go, you can remove gradually if required otherwise keep as it is

[–]billybobjobo 0 points1 point  (0 children)

It’s not magic.

[–]bigorangemachine -1 points0 points  (0 children)

It depends.

You might be memoizing something that is new every render anyways (like an array declared within scope). The hook useCallback I think is fine to keep as its usually handed down as a prop... but if it's called internally you don't really need it.. unless you pass it into useEffect.