MCPcopy
hub / github.com/plotly/dash / getComponentNameFromType

Function getComponentNameFromType

dash/deps/react-dom@18.2.0.js:1299–1380  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

1297
1298
1299 function getComponentNameFromType(type) {
1300 if (type == null) {
1301 // Host root, text node or just invalid type.
1302 return null;
1303 }
1304
1305 {
1306 if (typeof type.tag === 'number') {
1307 error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
1308 }
1309 }
1310
1311 if (typeof type === 'function') {
1312 return type.displayName || type.name || null;
1313 }
1314
1315 if (typeof type === 'string') {
1316 return type;
1317 }
1318
1319 switch (type) {
1320 case REACT_FRAGMENT_TYPE:
1321 return 'Fragment';
1322
1323 case REACT_PORTAL_TYPE:
1324 return 'Portal';
1325
1326 case REACT_PROFILER_TYPE:
1327 return 'Profiler';
1328
1329 case REACT_STRICT_MODE_TYPE:
1330 return 'StrictMode';
1331
1332 case REACT_SUSPENSE_TYPE:
1333 return 'Suspense';
1334
1335 case REACT_SUSPENSE_LIST_TYPE:
1336 return 'SuspenseList';
1337
1338 }
1339
1340 if (typeof type === 'object') {
1341 switch (type.$$typeof) {
1342 case REACT_CONTEXT_TYPE:
1343 var context = type;
1344 return getContextName(context) + '.Consumer';
1345
1346 case REACT_PROVIDER_TYPE:
1347 var provider = type;
1348 return getContextName(provider._context) + '.Provider';
1349
1350 case REACT_FORWARD_REF_TYPE:
1351 return getWrappedName(type, type.render, 'ForwardRef');
1352
1353 case REACT_MEMO_TYPE:
1354 var outerName = type.displayName || null;
1355
1356 if (outerName !== null) {

Callers 15

checkClassInstanceFunction · 0.70
constructClassInstanceFunction · 0.70
mountClassInstanceFunction · 0.70
updateForwardRefFunction · 0.70
updateMemoComponentFunction · 0.70
updateFunctionComponentFunction · 0.70
updateClassComponentFunction · 0.70
mountLazyComponentFunction · 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…