createPortal() — react Function Reference
Architecture documentation for the createPortal() function in ReactPortal.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD d4c9cbcd_03d1_24b7_9cf8_37c0a2c4460e["createPortal()"] bcda653c_3560_f9a9_6aee_b0a921e0d32a["ReactPortal.js"] d4c9cbcd_03d1_24b7_9cf8_37c0a2c4460e -->|defined in| bcda653c_3560_f9a9_6aee_b0a921e0d32a style d4c9cbcd_03d1_24b7_9cf8_37c0a2c4460e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-reconciler/src/ReactPortal.js lines 19–45
export function createPortal(
children: ReactNodeList,
containerInfo: any,
// TODO: figure out the API for cross-renderer implementation.
implementation: any,
key: ?string | ReactOptimisticKey = null,
): ReactPortal {
let resolvedKey;
if (key == null) {
resolvedKey = null;
} else if (key === REACT_OPTIMISTIC_KEY) {
resolvedKey = REACT_OPTIMISTIC_KEY;
} else {
if (__DEV__) {
checkKeyStringCoercion(key);
}
resolvedKey = '' + key;
}
return {
// This tag allow us to uniquely identify this as a React Portal
$$typeof: REACT_PORTAL_TYPE,
key: resolvedKey,
children,
containerInfo,
implementation,
};
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does createPortal() do?
createPortal() is a function in the react codebase, defined in packages/react-reconciler/src/ReactPortal.js.
Where is createPortal() defined?
createPortal() is defined in packages/react-reconciler/src/ReactPortal.js at line 19.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free