MCPcopy Create free account
hub / github.com/Lucifier129/react-lite / getNodeFromInstance

Function getNodeFromInstance

examples/simple/react.js:10766–10775  ·  view source on GitHub ↗

* Finds the node with the supplied public React instance. * * @param {*} instance A public React instance. * @return {?DOMElement} DOM node with the suppled `id`. * @internal

(instance)

Source from the content-addressed store, hash-verified

10764 * @internal
10765 */
10766function getNodeFromInstance(instance) {
10767 var id = ReactInstanceMap.get(instance)._rootNodeID;
10768 if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
10769 return null;
10770 }
10771 if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
10772 nodeCache[id] = ReactMount.findReactNodeByID(id);
10773 }
10774 return nodeCache[id];
10775}
10776
10777/**
10778 * A node is "valid" if it is contained by a currently mounted container.

Callers

nothing calls this directly

Calls 1

isValidFunction · 0.85

Tested by

no test coverage detected