BetaSu / just-react

「React技术揭秘」 一本自顶向下的React源码分析书
https://react.iamkasong.com/
MIT License
6.1k stars 540 forks source link

为什么rootFiber节点存在current(即rootFiber.alternate) #10

Open SiroSong opened 4 years ago

SiroSong commented 4 years ago

作者这里https://react.iamkasong.com/process/beginWork.html#effecttag说RootFiber在mount阶段就会有alternate的原因在双缓存那一节,究竟是什么原因,为什么我没有找到🥶

BetaSu commented 4 years ago

双缓存一节mount时的第二步,从图中你会发现有2个rootFiberworkInProgress rootFiber.alternate === current rootFiber

SiroSong commented 4 years ago

奥奥,是这样啊