Skip to content

.tip

· one of the small things

Turn on the React Compiler, then delete the memo hooks

The compiler memoises values, JSX and callbacks by analysing your code, which is what your useMemo and useCallback did by hand, except it never forgets a dependency.

// next.config.ts
export default { reactCompiler: true };

Run the compiler's ESLint plugin first. The components it skips are the ones breaking the rules of React, and those are the bugs your memo hooks had been papering over.

reactperformance

Longer version: the post this came from.