ReactDOMRoot类
function ReactDOMRoot(internalRoot) {
this._internalRoot = internalRoot;
}
ReactDOMRoot.prototype.render =
function (children) {
var root = this._internalRoot;
if (null === root) throw Error(formatProdErrorMessage(409));
var current = root.current,
lane = requestUpdateLane();
updateContainerImpl(current, lane, children, root, null, null);
};
ReactDOMRoot.prototype.unmount =
function () {
var root = this._internalRoot;
if (null !== root) {
this._internalRoot = null;
var container = root.containerInfo;
updateContainerImpl(root.current, 2, null, root, null, null);
flushSyncWork$1();
container[internalContainerInstanceKey] = null;
}
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function requestUpdateLane() {
return 0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes
? workInProgressRootRenderLanes & -workInProgressRootRenderLanes
: null !== ReactSharedInternals.T
? requestTransitionLane()
: resolveUpdatePriority();
}
1
2
3
4
5
6
7
2
3
4
5
6
7
编辑 (opens new window)
上次更新: 2026/01/20, 09:26:42