React/19/Remove Memoization

1.0.7Last update Jul 24, 2024
by@alexbit-codemod
React
React-compiler
React-forget
migration

This codemod will remove manual memoization hooks: useCallback, useMemo and memo. This codemod goes hand in hand with React Compiler.

Please note that this is not a safe codemod, as the compiler isn't 1-1 with inserting useMemo/useCallback, so there may be some occurrences that need to be kept in order to keep the semantics.

Example

Before:

import { memo } from 'react';
const MyComponent = ({ name }) => {
return <div>Hello, {name}!</div>;
};
const MemoizedMyComponent = memo(MyComponent);

After:

const MyComponent = ({ name }) => {
return <div>Hello, {name}!</div>;
};
const MemoizedMyComponent = MyComponent;

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now