老师,这里为什么要用bind,我理解是在调用performConcurrentWorkOnRoot 时,实际上是在执行绑定后的函数,并将 root 作为参数传递给它,可是用意是什么呢,直接传递root进入performConcurrentWorkOnRoot不可以吗
/**
* 确保根节点被调度执行。
* @param {*} root - 根节点。
*/
function ensureRootIsScheduled(root) {
scheduleCallback(performConcurrentWorkOnRoot.bind(null, root)); // 为什么使用bind
}
/**
* 执行根节点上的并发工作。
* @param {*} root - 根节点。
*/
function performConcurrentWorkOnRoot(root) {
renderRootSync(root);
const finishedWork = root.current.alternate;
root.finishedWork = finishedWork;
// commitRoot(root);
}