MCPcopy Create free account
hub / github.com/Lobos/react-ui / findDOMNode

Function findDOMNode

docs/lib/react.js:16437–16463  ·  view source on GitHub ↗

* Returns the DOM node rendered by this element. * * @param {ReactComponent|DOMElement} componentOrElement * @return {?DOMElement} The root node of this element.

(componentOrElement)

Source from the content-addressed store, hash-verified

16435 * @return {?DOMElement} The root node of this element.
16436 */
16437function findDOMNode(componentOrElement) {
16438 if ("development" !== 'production') {
16439 var owner = ReactCurrentOwner.current;
16440 if (owner !== null) {
16441 "development" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
16442 owner._warnedAboutRefsInRender = true;
16443 }
16444 }
16445 if (componentOrElement == null) {
16446 return null;
16447 }
16448 if (componentOrElement.nodeType === 1) {
16449 return componentOrElement;
16450 }
16451
16452 var inst = ReactInstanceMap.get(componentOrElement);
16453 if (inst) {
16454 inst = getNativeComponentFromComposite(inst);
16455 return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
16456 }
16457
16458 if (typeof componentOrElement.render === 'function') {
16459 !false ? "development" !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : void 0;
16460 } else {
16461 !false ? "development" !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : void 0;
16462 }
16463}
16464
16465module.exports = findDOMNode;
16466},{"126":126,"156":156,"166":166,"33":33,"38":38,"69":69}],119:[function(_dereq_,module,exports){

Callers

nothing calls this directly

Calls 3

warningFunction · 0.85
invariantFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…