MCPcopy Index your code
hub / github.com/plotly/dash / createRoot

Function createRoot

dash/deps/react-dom@18.2.0.js:29353–29398  ·  view source on GitHub ↗
(container, options)

Source from the content-addressed store, hash-verified

29351 };
29352
29353 function createRoot(container, options) {
29354 if (!isValidContainer(container)) {
29355 throw new Error('createRoot(...): Target container is not a DOM element.');
29356 }
29357
29358 warnIfReactDOMContainerInDEV(container);
29359 var isStrictMode = false;
29360 var concurrentUpdatesByDefaultOverride = false;
29361 var identifierPrefix = '';
29362 var onRecoverableError = defaultOnRecoverableError;
29363 var transitionCallbacks = null;
29364
29365 if (options !== null && options !== undefined) {
29366 {
29367 if (options.hydrate) {
29368 warn('hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, <App />) instead.');
29369 } else {
29370 if (typeof options === 'object' && options !== null && options.$$typeof === REACT_ELEMENT_TYPE) {
29371 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 />);');
29372 }
29373 }
29374 }
29375
29376 if (options.unstable_strictMode === true) {
29377 isStrictMode = true;
29378 }
29379
29380 if (options.identifierPrefix !== undefined) {
29381 identifierPrefix = options.identifierPrefix;
29382 }
29383
29384 if (options.onRecoverableError !== undefined) {
29385 onRecoverableError = options.onRecoverableError;
29386 }
29387
29388 if (options.transitionCallbacks !== undefined) {
29389 transitionCallbacks = options.transitionCallbacks;
29390 }
29391 }
29392
29393 var root = createContainer(container, ConcurrentRoot, null, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
29394 markContainerAsRoot(root.current, container);
29395 var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
29396 listenToAllSupportedEvents(rootContainerElement);
29397 return new ReactDOMRoot(root);
29398 }
29399
29400 function ReactDOMHydrationRoot(internalRoot) {
29401 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…