Turn on the React Compiler, then delete the memo hooks
The compiler memoises values, JSX and callbacks by analysing the code, which is what your useMemo and useCallback did by hand, without forgetting 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 were the bugs your memo hooks were papering over.
reactperformance
Longer version: the post this came from.