React
React-compiler
React-forget
migration
byalexbit-codemod

React/19/Remove Memoization

/icons/calendar.svg

Last update

Jul 24, 2024

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