MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / legacyCreateRootFromDOMContainer

Function legacyCreateRootFromDOMContainer

code/redux/public/app.js:18049–18074  ·  view source on GitHub ↗
(container, forceHydrate)

Source from the content-addressed store, hash-verified

18047var warnedAboutHydrateAPI = false;
18048
18049function legacyCreateRootFromDOMContainer(container, forceHydrate) {
18050 var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container);
18051 // First clear any existing content.
18052 if (!shouldHydrate) {
18053 var warned = false;
18054 var rootSibling = void 0;
18055 while (rootSibling = container.lastChild) {
18056 {
18057 if (!warned && rootSibling.nodeType === ELEMENT_NODE && rootSibling.hasAttribute(ROOT_ATTRIBUTE_NAME)) {
18058 warned = true;
18059 warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.');
18060 }
18061 }
18062 container.removeChild(rootSibling);
18063 }
18064 }
18065 {
18066 if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
18067 warnedAboutHydrateAPI = true;
18068 lowPriorityWarning$1(false, 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'will stop working in React v17. Replace the ReactDOM.render() call ' + 'with ReactDOM.hydrate() if you want React to attach to the server HTML.');
18069 }
18070 }
18071 // Legacy roots are not async by default.
18072 var isAsync = false;
18073 return new ReactRoot(container, isAsync, shouldHydrate);
18074}
18075
18076function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
18077 // TODO: Ensure all entry points contain this check

Callers 1

Calls 2

warningFunction · 0.85

Tested by

no test coverage detected