Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forwardRef et al shouldn't affect if props object is reused #24421

Merged
merged 1 commit into from Apr 22, 2022

Commits on Apr 21, 2022

  1. forwardRef et al shouldn't affect if props reused

    We don't have strong guarantees that the props object is referentially
    equal during updates where we can't bail out anyway — like if the props
    are shallowly equal, but there's a local state or context update in the
    same batch.
    
    However, as a principle, we should aim to make the behavior consistent
    across different ways of memoizing a component. For example, React.memo
    has a different internal Fiber layout if you pass a normal function
    component (SimpleMemoComponent) versus if you pass a different type like
    forwardRef (MemoComponent). But this is an implementation detail.
    Wrapping a component in forwardRef (or React.lazy, etc) shouldn't affect
    whether the props object is reused during a bailout.
    
    Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
    acdlite and Andarist committed Apr 21, 2022
    Copy the full SHA
    3b190a6 View commit details
    Browse the repository at this point in the history