Last active
January 2, 2019 12:47
-
-
Save CarlMungazi/69a5f23df89e2cd033e9bf5113c9081a to your computer and use it in GitHub Desktop.
LegacyRenderSubtreeIntoContainer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) { | |
... | |
let root = container._reactRootContainer; | |
if (!root) { | |
// Initial mount | |
root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate); | |
if (typeof callback === 'function') { | |
const originalCallback = callback; | |
callback = function () { | |
const instance = DOMRenderer.getPublicRootInstance(root._internalRoot); | |
originalCallback.call(instance); | |
}; | |
} | |
// Initial mount should not be batched. | |
DOMRenderer.unbatchedUpdates(() => { | |
if (parentComponent != null) { | |
root.legacy_renderSubtreeIntoContainer( | |
parentComponent, | |
children, | |
callback, | |
); | |
} else { | |
root.render(children, callback); | |
} | |
}); | |
} else { | |
... | |
} | |
return DOMRenderer.getPublicRootInstance(root._internalRoot); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment