MCPcopy Index your code
hub / github.com/react/react / createPortal

Function createPortal

packages/react-dom/src/client/ReactDOMClientFB.js:75–87  ·  view source on GitHub ↗
(
  children: ReactNodeList,
  container: Element | DocumentFragment,
  key: ?string = null,
)

Source from the content-addressed store, hash-verified

73}
74
75function createPortal(
76 children: ReactNodeList,
77 container: Element | DocumentFragment,
78 key: ?string = null,
79): React$Portal {
80 if (!isValidContainer(container)) {
81 throw new Error('Target container is not a DOM element.');
82 }
83
84 // TODO: pass ReactDOM portal implementation as third argument
85 // $FlowFixMe[incompatible-return] The Flow type is opaque but there's no way to actually create it.
86 return createPortalImpl(children, container, null, key);
87}
88
89// Overload the definition to the two valid signatures.
90// Warning, this opts-out of checking the function body.

Callers

nothing calls this directly

Calls 1

isValidContainerFunction · 0.90

Tested by

no test coverage detected