mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Rendering into an empty React-rendered element should not warn
Only warn if the container has a React-rendered child.
This commit is contained in:
@@ -399,10 +399,11 @@ var ReactDOM = {
|
||||
|
||||
if (__DEV__) {
|
||||
const isRootRenderedBySomeReact = Boolean(container._reactRootContainer);
|
||||
const isInTreeRenderedByThisReact = ReactDOMComponentTree.getInstanceFromNode(container);
|
||||
const rootEl = getReactRootElementInContainer(container);
|
||||
const hasNonRootReactChild = Boolean(rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl));
|
||||
|
||||
warning(
|
||||
!isInTreeRenderedByThisReact ||
|
||||
!hasNonRootReactChild ||
|
||||
isRootRenderedBySomeReact,
|
||||
'render(...): Replacing React-rendered children with a new root ' +
|
||||
'component. If you intended to update the children of this node, ' +
|
||||
|
||||
Reference in New Issue
Block a user