Skip to content

Collision between two React copies running on the same DOM (ReactMount: Two valid but unequal nodes with the same data-reactid: .0.0.2) #2713

Closed
@chandlerprall

Description

@chandlerprall

I'm working on a Chrome extension that injects data into the current page. Chrome extensions have a concept of a "content script" which has access to the page's DOM but not any of the page's JavaScript variables. This means I can include React for that page's DOM but there may already be React running on the page, and there won't be any conflicts in the code. However, with two copies of React running I ran into Uncaught Error: Invariant Violation: ReactMount: Two valid but unequal nodes with the samedata-reactid: .0.0.2 for obvious reasons.

My solution was to modify my extension's version of React to change DOMProperty.ID_ATTRIBUTE_NAME to data-extensionreactid to avoid these conflicts. Is there a better way than modifying React's source?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions