MCPcopy Index your code
hub / github.com/plotly/dash / getComponentNameFromType

Function getComponentNameFromType

dash/deps/react@18.2.0.js:519–600  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

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

Callers 5

validateExplicitKeyFunction · 0.70
validatePropTypesFunction · 0.70

Calls 3

errorFunction · 0.70
getContextNameFunction · 0.70
getWrappedNameFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…