MCPcopy Create free account
hub / github.com/danielstocks/react-sortable / getInstanceFromNode

Function getInstanceFromNode

bundle.js:5642–5642  ·  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

5640 * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
5641 * instance, or null if the node was not rendered by this React.
5642 */function getInstanceFromNode(node){var inst=node[internalInstanceKey];if(inst){if(inst.tag===HostComponent||inst.tag===HostText){return inst;}else if(inst._hostNode===node){return inst;}else{return null;}}inst=getClosestInstanceFromNode(node);if(inst!=null&&inst._hostNode===node){return inst;}else{return null;}}/**
5643 * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
5644 * DOM node.
5645 */function getNodeFromInstance(inst){if(inst.tag===HostComponent||inst.tag===HostText){// In Fiber this, is just the state node right now. We assume it will be

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected