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

Function getComponentName

examples/typescript-react/js/bundle.js:3277–3328  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

3275}
3276
3277function getComponentName(type) {
3278 if (type == null) {
3279 // Host root, text node or just invalid type.
3280 return null;
3281 }
3282 {
3283 if (typeof type.tag === 'number') {
3284 warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
3285 }
3286 }
3287 if (typeof type === 'function') {
3288 return type.displayName || type.name || null;
3289 }
3290 if (typeof type === 'string') {
3291 return type;
3292 }
3293 switch (type) {
3294 case REACT_CONCURRENT_MODE_TYPE:
3295 return 'ConcurrentMode';
3296 case REACT_FRAGMENT_TYPE:
3297 return 'Fragment';
3298 case REACT_PORTAL_TYPE:
3299 return 'Portal';
3300 case REACT_PROFILER_TYPE:
3301 return 'Profiler';
3302 case REACT_STRICT_MODE_TYPE:
3303 return 'StrictMode';
3304 case REACT_SUSPENSE_TYPE:
3305 return 'Suspense';
3306 }
3307 if (typeof type === 'object') {
3308 switch (type.$$typeof) {
3309 case REACT_CONTEXT_TYPE:
3310 return 'Context.Consumer';
3311 case REACT_PROVIDER_TYPE:
3312 return 'Context.Provider';
3313 case REACT_FORWARD_REF_TYPE:
3314 return getWrappedName(type, type.render, 'ForwardRef');
3315 case REACT_MEMO_TYPE:
3316 return getComponentName(type.type);
3317 case REACT_LAZY_TYPE:
3318 {
3319 var thenable = type;
3320 var resolvedThenable = refineResolvedLazyComponent(thenable);
3321 if (resolvedThenable) {
3322 return getComponentName(resolvedThenable);
3323 }
3324 }
3325 }
3326 }
3327 return null;
3328}
3329
3330var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
3331

Callers 15

describeFiberFunction · 0.85
isMountedFunction · 0.85
beginFiberMarkFunction · 0.85
clearFiberMarkFunction · 0.85
endFiberMarkFunction · 0.85
stopWorkLoopTimerFunction · 0.85
getMaskedContextFunction · 0.85
processChildContextFunction · 0.85
bundle.jsFile · 0.85

Calls 2

getWrappedNameFunction · 0.85

Tested by

no test coverage detected