MCPcopy Create free account
hub / github.com/reactjs/react-rails / getInstanceFromNode$1

Function getInstanceFromNode$1

lib/assets/react-source/development/react.js:11616–11628  ·  view source on GitHub ↗

* Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent * instance, or null if the node was not rendered by this React.

(node)

Source from the content-addressed store, hash-verified

11614 */
11615
11616 function getInstanceFromNode$1(node) {
11617 var inst = node[internalInstanceKey] || node[internalContainerInstanceKey];
11618
11619 if (inst) {
11620 if (inst.tag === HostComponent || inst.tag === HostText || inst.tag === SuspenseComponent || inst.tag === HostRoot) {
11621 return inst;
11622 } else {
11623 return null;
11624 }
11625 }
11626
11627 return null;
11628 }
11629 /**
11630 * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
11631 * DOM node.

Calls

no outgoing calls

Tested by

no test coverage detected