Home / Function/ createPortal() — react Function Reference

createPortal() — react Function Reference

Architecture documentation for the createPortal() function in ReactDOMClientFB.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  88a85190_740f_7750_82ae_d474e8621115["createPortal()"]
  1b3f328f_ac2c_6e3e_233b_fbbe5d0412b0["ReactDOMClientFB.js"]
  88a85190_740f_7750_82ae_d474e8621115 -->|defined in| 1b3f328f_ac2c_6e3e_233b_fbbe5d0412b0
  style 88a85190_740f_7750_82ae_d474e8621115 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom/src/client/ReactDOMClientFB.js lines 75–87

function createPortal(
  children: ReactNodeList,
  container: Element | DocumentFragment,
  key: ?string = null,
): React$Portal {
  if (!isValidContainer(container)) {
    throw new Error('Target container is not a DOM element.');
  }

  // TODO: pass ReactDOM portal implementation as third argument
  // $FlowFixMe[incompatible-return] The Flow type is opaque but there's no way to actually create it.
  return createPortalImpl(children, container, null, key);
}

Domain

Subdomains

Frequently Asked Questions

What does createPortal() do?
createPortal() is a function in the react codebase, defined in packages/react-dom/src/client/ReactDOMClientFB.js.
Where is createPortal() defined?
createPortal() is defined in packages/react-dom/src/client/ReactDOMClientFB.js at line 75.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free