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

Function getComponentName

dash/deps/react@16.14.0.js:221–293  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

219 }
220
221 function getComponentName(type) {
222 if (type == null) {
223 // Host root, text node or just invalid type.
224 return null;
225 }
226
227 {
228 if (typeof type.tag === 'number') {
229 error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
230 }
231 }
232
233 if (typeof type === 'function') {
234 return type.displayName || type.name || null;
235 }
236
237 if (typeof type === 'string') {
238 return type;
239 }
240
241 switch (type) {
242 case REACT_FRAGMENT_TYPE:
243 return 'Fragment';
244
245 case REACT_PORTAL_TYPE:
246 return 'Portal';
247
248 case REACT_PROFILER_TYPE:
249 return "Profiler";
250
251 case REACT_STRICT_MODE_TYPE:
252 return 'StrictMode';
253
254 case REACT_SUSPENSE_TYPE:
255 return 'Suspense';
256
257 case REACT_SUSPENSE_LIST_TYPE:
258 return 'SuspenseList';
259 }
260
261 if (typeof type === 'object') {
262 switch (type.$$typeof) {
263 case REACT_CONTEXT_TYPE:
264 return 'Context.Consumer';
265
266 case REACT_PROVIDER_TYPE:
267 return 'Context.Provider';
268
269 case REACT_FORWARD_REF_TYPE:
270 return getWrappedName(type, type.render, 'ForwardRef');
271
272 case REACT_MEMO_TYPE:
273 return getComponentName(type.type);
274
275 case REACT_BLOCK_TYPE:
276 return getComponentName(type.render);
277
278 case REACT_LAZY_TYPE:

Callers 6

react@16.14.0.jsFile · 0.70
validateExplicitKeyFunction · 0.70
validatePropTypesFunction · 0.70

Calls 3

errorFunction · 0.70
getWrappedNameFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…