describeElementType() — react Function Reference
Architecture documentation for the describeElementType() function in ReactSerializationErrors.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD ec35c129_c109_ef36_1a8b_7b3ecc6cb827["describeElementType()"] 07b21cf4_35fa_b825_b4d7_94b229a65c00["ReactSerializationErrors.js"] ec35c129_c109_ef36_1a8b_7b3ecc6cb827 -->|defined in| 07b21cf4_35fa_b825_b4d7_94b229a65c00 style ec35c129_c109_ef36_1a8b_7b3ecc6cb827 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shared/ReactSerializationErrors.js lines 137–167
function describeElementType(type: any): string {
if (typeof type === 'string') {
return type;
}
switch (type) {
case REACT_SUSPENSE_TYPE:
return 'Suspense';
case REACT_SUSPENSE_LIST_TYPE:
return 'SuspenseList';
case REACT_VIEW_TRANSITION_TYPE:
if (enableViewTransition) {
return 'ViewTransition';
}
}
if (typeof type === 'object') {
switch (type.$$typeof) {
case REACT_FORWARD_REF_TYPE:
return describeElementType(type.render);
case REACT_MEMO_TYPE:
return describeElementType(type.type);
case REACT_LAZY_TYPE: {
const lazyComponent: LazyComponent<any, any> = (type: any);
const payload = lazyComponent._payload;
const init = lazyComponent._init;
try {
// Lazy may contain any component type so we recursively resolve it.
return describeElementType(init(payload));
} catch (x) {}
}
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does describeElementType() do?
describeElementType() is a function in the react codebase, defined in packages/shared/ReactSerializationErrors.js.
Where is describeElementType() defined?
describeElementType() is defined in packages/shared/ReactSerializationErrors.js at line 137.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free