本文整理匯總了TypeScript中react-fiber-export.IRenderer.updateContainer方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript IRenderer.updateContainer方法的具體用法?TypeScript IRenderer.updateContainer怎麽用?TypeScript IRenderer.updateContainer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類react-fiber-export.IRenderer
的用法示例。
在下文中一共展示了IRenderer.updateContainer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: renderSubtreeIntoContainer
function renderSubtreeIntoContainer(reconciler: IRenderer,
contextSymbol: symbol,
rootContainerSymbol: symbol,
parentComponent: React.Component<any, any> | null,
children: any,
container: any,
forceHydrate: boolean,
callback: () => void) {
if (forceHydrate) {
throw new Error("forceHydrate not implemented yet");
}
let root = container[rootContainerSymbol];
if (!root) {
const newRoot = reconciler.createContainer(container);
container[rootContainerSymbol] = newRoot;
const renderActionsForContainer: RenderAction[] = [];
if (container[contextSymbol] === undefined) {
// noinspection UnnecessaryLocalVariableJS
const rootContext: IHostContext = {
triggerRender() {
// console.log("render triggered for", renderActionsForContainer);
renderActionsForContainer.forEach((action: RenderAction) => {
action.triggerRender();
});
},
renderActionFound(action: RenderAction) {
// console.log("render action found", action);
renderActionsForContainer.push(action);
},
};
container[contextSymbol] = rootContext;
}
root = newRoot;
reconciler.unbatchedUpdates(() => {
reconciler.updateContainer(children, newRoot, parentComponent, callback);
});
} else {
reconciler.updateContainer(children, root, parentComponent, callback);
}
return reconciler.getPublicRootInstance(root);
}
示例2:
reconciler.unbatchedUpdates(() => {
reconciler.updateContainer(children, newRoot, parentComponent, callback);
});