@samitouri / QOS-React / commits / f4823295af

Warn when rendering into React-rendered child that isn't a root

Andrew Clark committed Feb 1, 2017 at 18:18 UTC f4823295af9792c2ef6e0e7da6a4628009dd227d
1 file changed +9
src/renderers/dom/fiber/ReactDOMFiber.js
+9
@@ -386,6 +386,15 @@ var ReactDOM = {
386 }
387
388 if (__DEV__) {
389 + warning(
390 + !ReactDOMComponentTree.getInstanceFromNode(container) ||
391 + container._reactRootContainer,
392 + 'render(...): Replacing React-rendered children with a new root ' +
393 + 'component. If you intended to update the children of this node, ' +
394 + 'you should instead have the existing children update their state ' +
395 + 'and render the new components instead of calling ReactDOM.render.'
396 + );
397 +
398 warning(
399 !container.tagName || container.tagName.toUpperCase() !== 'BODY',
400 'render(): Rendering components directly into document.body is ' +