You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposal: Disallow manual memoization in components that compile with React Compiler.
Background
React Compiler has been in place years now, and it memoizes React components and hooks, injecting React.memo, useMemo, and useCallback automatically at compile time. The memoization performed by React Compiler is generally more robust than manual memoization:
Mistakes in dependency arrays are not possible
It's often more granular than memoization we'd be likely to write by hand
We have existing CI checks that enforce that:
All new components compile with React Compiler
Any existing components cannot regress (i.e: if they compile on main, then a PR can't break them)
We've also completed several broad migrations where we refactor batches of components to:
Remove Rules of React violations such that they compile with React Compiler
Remove all manual memoization
So far, none of these migrations have caused any regressions.
Problem
When we write React code and use the React Compiler, if we include manual memoization, then the code becomes more complex for no gain, and in fact less-efficient memoization or mistakes in dependency arrays become possible.
Solution
Disallow the use of React.memo, useMemo, and useCallback in any components that compile with React Compiler. Specifically, we can enforce this with a custom lint rule: we already have the React Compiler plugged into our lint pipeline, such that different rules can apply for components that compile vs components that don't.
Note: There is one exception that should be allowed: useFocusEffect produces a warning if the callback isn't explicitly wrapped with useCallback, so we'll allow useCallback in that case.
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.24-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
Activity
roryabraham commentedon Oct 21, 2026
Opened pull request, requested AdHoc QA.
roryabraham commentedon Oct 23, 2026
@truph01 is going to help with C+ review and manual testing, on top of the full regression run being performed by Applause
truph01 commentedon Oct 27, 2026
@roryabraham Actually, the PR was merged without requiring a C+ review.
roryabraham commentedon Oct 27, 2026
Going to leave this open at least until the PR deploys to prod
melvin-bot commentedon Oct 27, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
melvin-bot commentedon Oct 28, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
melvin-bot commentedon Oct 29, 2026
@roryabraham
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.24-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
roryabraham commentedon Oct 29, 2026
done, no payments due