MCPcopy Index your code
hub / github.com/reactjs/react-rails / getComponentName

Function getComponentName

lib/assets/react-source/development/react.js:527–599  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

525 }
526
527 function getComponentName(type) {
528 if (type == null) {
529 // Host root, text node or just invalid type.
530 return null;
531 }
532
533 {
534 if (typeof type.tag === 'number') {
535 error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
536 }
537 }
538
539 if (typeof type === 'function') {
540 return type.displayName || type.name || null;
541 }
542
543 if (typeof type === 'string') {
544 return type;
545 }
546
547 switch (type) {
548 case REACT_FRAGMENT_TYPE:
549 return 'Fragment';
550
551 case REACT_PORTAL_TYPE:
552 return 'Portal';
553
554 case REACT_PROFILER_TYPE:
555 return "Profiler";
556
557 case REACT_STRICT_MODE_TYPE:
558 return 'StrictMode';
559
560 case REACT_SUSPENSE_TYPE:
561 return 'Suspense';
562
563 case REACT_SUSPENSE_LIST_TYPE:
564 return 'SuspenseList';
565 }
566
567 if (typeof type === 'object') {
568 switch (type.$$typeof) {
569 case REACT_CONTEXT_TYPE:
570 return 'Context.Consumer';
571
572 case REACT_PROVIDER_TYPE:
573 return 'Context.Provider';
574
575 case REACT_FORWARD_REF_TYPE:
576 return getWrappedName(type, type.render, 'ForwardRef');
577
578 case REACT_MEMO_TYPE:
579 return getComponentName(type.type);
580
581 case REACT_BLOCK_TYPE:
582 return getComponentName(type.render);
583
584 case REACT_LAZY_TYPE:

Callers 15

react.jsFile · 0.70
validateExplicitKeyFunction · 0.70
validatePropTypesFunction · 0.70
describeFiberFunction · 0.70
isMountedFunction · 0.70
beginFiberMarkFunction · 0.70
clearFiberMarkFunction · 0.70
endFiberMarkFunction · 0.70

Calls 3

errorFunction · 0.70
getWrappedNameFunction · 0.70

Tested by

no test coverage detected