Skip to content

"Missing React element for debugID" warning when triggering a render in componentWillMount #7187

@yannickcr

Description

@yannickcr

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
As reported by @adamryvola in #6869 (comment), React is displaying a warning Warning: ReactComponentTreeDevtool: Missing React element for debugID 2 when building stack when another component is rendered in componentWillMount

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/reactjs/69z2wepo/).

import React, {Component} from 'react';
import ReactDOM from 'react-dom';

const container = document.getElementById('container');
const menuContainer = document.getElementById('menu-container');

export default class App extends Component {

  componentWillMount() {
    ReactDOM.render(<div />, menuContainer);  // <= Trigger the warning
  }

  render() {
    return (
      <div>
        <div>App</div>
      </div>
    );
  }
}

ReactDOM.render(<App />, container);

JSFiddle: https://jsfiddle.net/0n3a6vp9/

What is the expected behavior?
According to @gaearon this warning is "against internal bugs in React, it's not meant for users" (source: #6869 (comment)) so this warning should not be triggered.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React 15.2.0, no issue with React 0.14.7

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions