AI

Passing new function references to optimized children breaks optimizations. React.memo only works if props remain stable.

Your Task:

  • The ExpensiveChart component is wrapped in React.memo, but it still re-renders whenever the parent updates
  • This is because handleResize is a new function every time
  • Wrap handleResize in useCallback to stabilize its reference
TypeScript Solution
Loading...

Submit your code to see test results