isValidElementType() — react Function Reference
Architecture documentation for the isValidElementType() function in ReactIs.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 47bf41b8_cea1_270e_dbd8_919e33dfae18["isValidElementType()"] dfae0a13_bd8b_97d9_0260_bcccc6acd4f8["ReactIs.js"] 47bf41b8_cea1_270e_dbd8_919e33dfae18 -->|defined in| dfae0a13_bd8b_97d9_0260_bcccc6acd4f8 style 47bf41b8_cea1_270e_dbd8_919e33dfae18 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-is/src/ReactIs.js lines 92–131
export function isValidElementType(type: mixed): boolean {
if (typeof type === 'string' || typeof type === 'function') {
return true;
}
// Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
if (
type === REACT_FRAGMENT_TYPE ||
type === REACT_PROFILER_TYPE ||
type === REACT_STRICT_MODE_TYPE ||
type === REACT_SUSPENSE_TYPE ||
type === REACT_SUSPENSE_LIST_TYPE ||
(enableLegacyHidden && type === REACT_LEGACY_HIDDEN_TYPE) ||
(enableScopeAPI && type === REACT_SCOPE_TYPE) ||
(enableTransitionTracing && type === REACT_TRACING_MARKER_TYPE) ||
(enableViewTransition && type === REACT_VIEW_TRANSITION_TYPE)
) {
return true;
}
if (typeof type === 'object' && type !== null) {
if (
type.$$typeof === REACT_LAZY_TYPE ||
type.$$typeof === REACT_MEMO_TYPE ||
type.$$typeof === REACT_CONTEXT_TYPE ||
type.$$typeof === REACT_CONSUMER_TYPE ||
type.$$typeof === REACT_FORWARD_REF_TYPE ||
// This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
type.$$typeof === REACT_CLIENT_REFERENCE ||
type.getModuleId !== undefined
) {
return true;
}
}
return false;
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does isValidElementType() do?
isValidElementType() is a function in the react codebase, defined in packages/react-is/src/ReactIs.js.
Where is isValidElementType() defined?
isValidElementType() is defined in packages/react-is/src/ReactIs.js at line 92.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free