MCPcopy Create free account
hub / github.com/microsoft/SandDance / findDOMNode

Function findDOMNode

docs/external/js/react-dom.development.js:24915–24941  ·  view source on GitHub ↗
(componentOrElement)

Source from the content-addressed store, hash-verified

24913 }
24914
24915 function findDOMNode(componentOrElement) {
24916 {
24917 var owner = ReactCurrentOwner$3.current;
24918
24919 if (owner !== null && owner.stateNode !== null) {
24920 var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
24921
24922 if (!warnedAboutRefsInRender) {
24923 error('%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.', getComponentName(owner.type) || 'A component');
24924 }
24925
24926 owner.stateNode._warnedAboutRefsInRender = true;
24927 }
24928 }
24929
24930 if (componentOrElement == null) {
24931 return null;
24932 }
24933
24934 if (componentOrElement.nodeType === ELEMENT_NODE) {
24935 return componentOrElement;
24936 }
24937
24938 {
24939 return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
24940 }
24941 }
24942 function hydrate(element, container, callback) {
24943 if (!isValidContainer(container)) {
24944 {

Callers

nothing calls this directly

Calls 3

errorFunction · 0.70
getComponentNameFunction · 0.70

Tested by

no test coverage detected