MCPcopy Create free account
hub / github.com/plotly/dash / createRoot

Function createRoot

dash/deps/react-dom@18.3.1.js:29392–29437  ·  view source on GitHub ↗
(container, options)

Source from the content-addressed store, hash-verified

29390 };
29391
29392 function createRoot(container, options) {
29393 if (!isValidContainer(container)) {
29394 throw new Error('createRoot(...): Target container is not a DOM element.');
29395 }
29396
29397 warnIfReactDOMContainerInDEV(container);
29398 var isStrictMode = false;
29399 var concurrentUpdatesByDefaultOverride = false;
29400 var identifierPrefix = '';
29401 var onRecoverableError = defaultOnRecoverableError;
29402 var transitionCallbacks = null;
29403
29404 if (options !== null && options !== undefined) {
29405 {
29406 if (options.hydrate) {
29407 warn('hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, <App />) instead.');
29408 } else {
29409 if (typeof options === 'object' && options !== null && options.$$typeof === REACT_ELEMENT_TYPE) {
29410 error('You passed a JSX element to createRoot. You probably meant to ' + 'call root.render instead. ' + 'Example usage:\n\n' + ' let root = createRoot(domContainer);\n' + ' root.render(<App />);');
29411 }
29412 }
29413 }
29414
29415 if (options.unstable_strictMode === true) {
29416 isStrictMode = true;
29417 }
29418
29419 if (options.identifierPrefix !== undefined) {
29420 identifierPrefix = options.identifierPrefix;
29421 }
29422
29423 if (options.onRecoverableError !== undefined) {
29424 onRecoverableError = options.onRecoverableError;
29425 }
29426
29427 if (options.transitionCallbacks !== undefined) {
29428 transitionCallbacks = options.transitionCallbacks;
29429 }
29430 }
29431
29432 var root = createContainer(container, ConcurrentRoot, null, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
29433 markContainerAsRoot(root.current, container);
29434 var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
29435 listenToAllSupportedEvents(rootContainerElement);
29436 return new ReactDOMRoot(root);
29437 }
29438
29439 function ReactDOMHydrationRoot(internalRoot) {
29440 this._internalRoot = internalRoot;

Callers 1

createRoot$1Function · 0.70

Calls 7

isValidContainerFunction · 0.70
warnFunction · 0.70
errorFunction · 0.70
createContainerFunction · 0.70
markContainerAsRootFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…