Skip to content

setState after componentWillMount and between render and componentDidMount causes Invariant Violation #1353

Closed
@SlimFoster

Description

@SlimFoster

I have a situation where I simultaneously render multiple instances of the same component. During componentWillMount a check is made against one of the props passed to the component and an event may be raised that causes other components to update their state like in this example:

http://jsfiddle.net/rTv4n/

The problem seems to be that if one of the components' render method was called but the component has not yet been mounted and then you call setState, it throws this exception:

Uncaught Error: Invariant Violation: findComponentRoot(..., .0.$child1): Unable to find element. This probably means the DOM was unexpectedly mutated (e.g., by the browser). Try inspecting the child nodes of the element with React ID ``. react.js:15374

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