Skip to content

Instantly share code, notes, and snippets.

@CarlMungazi
Last active January 2, 2019 12:47
Show Gist options
  • Save CarlMungazi/69a5f23df89e2cd033e9bf5113c9081a to your computer and use it in GitHub Desktop.
Save CarlMungazi/69a5f23df89e2cd033e9bf5113c9081a to your computer and use it in GitHub Desktop.
LegacyRenderSubtreeIntoContainer
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