Skip to content

Remove "memoization-for-correctness" #443

Description

@severo

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:

  1. 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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions