diff --git a/packages/react-dom/src/client/ReactDOMLegacy.js b/packages/react-dom/src/client/ReactDOMLegacy.js index 519a0be3bb551..3479e26321ac1 100644 --- a/packages/react-dom/src/client/ReactDOMLegacy.js +++ b/packages/react-dom/src/client/ReactDOMLegacy.js @@ -22,6 +22,7 @@ import { DOCUMENT_NODE, ELEMENT_NODE, COMMENT_NODE, + DOCUMENT_FRAGMENT_NODE, } from '../shared/HTMLNodeType'; import { @@ -222,7 +223,7 @@ function legacyRenderSubtreeIntoContainer( } export function findDOMNode( - componentOrElement: Element | ?React$Component, + componentOrElement: Element | DocumentFragment | ?React$Component, ): null | Element | Text { if (__DEV__) { let owner = (ReactCurrentOwner.current: any); @@ -244,7 +245,8 @@ export function findDOMNode( if (componentOrElement == null) { return null; } - if ((componentOrElement: any).nodeType === ELEMENT_NODE) { + const nodeType = (componentOrElement: any).nodeType; + if (nodeType === ELEMENT_NODE || nodeType === DOCUMENT_FRAGMENT_NODE) { return (componentOrElement: any); } if (__DEV__) {