As stated in https://stevekinney.com/courses/react-performance/react-19-compiler-guide:
Memoization-for-correctness is a footgun. If your app relies on referential equality (e.g., effects that only work because an object identity stays stable), the compiler may memoize differently and expose those bugs—think effects over-firing or loops. The fix is to remove the reliance, not to fight the compiler.
Also referred here in the React compiler debugging guide:
- Fix Issues Step by Step
Identify the root cause (often memoization-for-correctness)
tbh, I didn't know it was a bad practice. And all the contexts are objects. (it's OK to memoize the context value: https://www.developerway.com/posts/react-re-renders-guide#part7)
As stated in https://stevekinney.com/courses/react-performance/react-19-compiler-guide:
Also referred here in the React compiler debugging guide:
tbh, I didn't know it was a bad practice.
And all the contexts are objects.(it's OK to memoize the context value: https://www.developerway.com/posts/react-re-renders-guide#part7)