MCPcopy
hub / github.com/tastejs/todomvc / findHostInstanceWithWarning

Function findHostInstanceWithWarning

examples/typescript-react/js/bundle.js:20261–20289  ·  view source on GitHub ↗
(component, methodName)

Source from the content-addressed store, hash-verified

20259}
20260
20261function findHostInstanceWithWarning(component, methodName) {
20262 {
20263 var fiber = get(component);
20264 if (fiber === undefined) {
20265 if (typeof component.render === 'function') {
20266 invariant(false, 'Unable to find node on an unmounted component.');
20267 } else {
20268 invariant(false, 'Argument appears to not be a ReactComponent. Keys: %s', Object.keys(component));
20269 }
20270 }
20271 var hostFiber = findCurrentHostFiber(fiber);
20272 if (hostFiber === null) {
20273 return null;
20274 }
20275 if (hostFiber.mode & StrictMode) {
20276 var componentName = getComponentName(fiber.type) || 'Component';
20277 if (!didWarnAboutFindNodeInStrictMode[componentName]) {
20278 didWarnAboutFindNodeInStrictMode[componentName] = true;
20279 if (fiber.mode & StrictMode) {
20280 warningWithoutStack$1(false, '%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-find-node', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
20281 } else {
20282 warningWithoutStack$1(false, '%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-find-node', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
20283 }
20284 }
20285 }
20286 return hostFiber.stateNode;
20287 }
20288 return findHostInstance(component);
20289}
20290
20291function createContainer(containerInfo, isConcurrent, hydrate) {
20292 return createFiberRoot(containerInfo, isConcurrent, hydrate);

Callers 1

bundle.jsFile · 0.85

Calls 6

findCurrentHostFiberFunction · 0.85
getComponentNameFunction · 0.85
findHostInstanceFunction · 0.85
getFunction · 0.70
invariantFunction · 0.70

Tested by

no test coverage detected