(container, options)
| 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; |
no test coverage detected
searching dependent graphs…