Skip to content

[Question] about "._owner.alternate" #15397

Closed
@HOUCe

Description

@HOUCe

It seems that in react@16 every React element children contains cyclic property ._owner.alternate.alternate.alternate.alternate....

image

So it is easy to cause "Maximum call stack exceeded" error when developer compares props.children in deep way(like deep-equal).

This caused bugs for community libraries like react-helmet:
nfl/react-helmet#441

I am extremely curious about:
Why React has _owner.alternate, and what it stands for?
As it is named as “_owner”, could it be better if we make “owner” not enumerable?

I tried to search source code and but still can’t find any clue.

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions