Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BetaSu committed Nov 10, 2022
2 parents dada7f0 + 3f3984c commit 6b69852
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

React从理念到源码,[开始阅读](https://react.iamkasong.com/)

从0实现React18,请看[big-react](https://github.com/BetaSu/big-react)

关注公众号:

- 拉你进本书对应的`源码交流群`和6000+小伙伴们一起交流`React`源码
如果想加入本书对应的`源码交流群`和7000+小伙伴们一起交流`React`源码,可以加我微信,备注「揭秘」:

- 卡颂的原创源码级`React`文章与视频
<img width="200" src="https://user-images.githubusercontent.com/15828041/181666959-57941b01-61b3-47db-9d73-ecc9ae175112.png" alt="公众号:卡颂的微信" />


<img width="200" src="https://p4.ssl.qhimg.com/t0125877eac50823b5a.jpg" alt="公众号:魔术师卡颂" />
1 change: 1 addition & 0 deletions docs/preparation/newConstructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const Deletion = /* */ 0b0000000001000;
## 参考资料

[「英文 外网」Building a Custom React Renderer | React前经理Sophie Alpert](https://www.youtube.com/watch?v=CGpMlWVcHok&list=PLPxbbTqCLbGHPxZpw4xj_Wwg8-fdNxJRh&index=7)
[hello-world-custom-react-renderer](https://agent-hunt.medium.com/hello-world-custom-react-renderer-9a95b7cd04bc)

:::details 同步/Debounce/Throttle/并发 情况下性能对比Demo

Expand Down
9 changes: 8 additions & 1 deletion docs/renderer/layout.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
该阶段之所以称为`layout`,因为该阶段的代码都是在`DOM`渲染完成(`mutation阶段`完成)后执行的。
该阶段之所以称为`layout`,因为该阶段的代码都是在`DOM`修改完成(`mutation阶段`完成)后执行的。

注意:由于 JS 的同步执行阻塞了主线程,所以此时 JS 已经可以获取到新的`DOM`,但是浏览器对新的`DOM`并没有完成渲染。

该阶段触发的生命周期钩子和`hook`可以直接访问到已经改变后的`DOM`,即该阶段是可以参与`DOM layout`的阶段。

Expand Down Expand Up @@ -169,3 +171,8 @@ root.current = finishedWork;
## 总结
从这节我们学到,`layout阶段`会遍历`effectList`,依次执行`commitLayoutEffects`。该方法的主要工作为“根据`effectTag`调用不同的处理函数处理`Fiber`并更新`ref`
## 参考资料
[useeffect-vs-uselayouteffect-examples](https://blog.logrocket.com/useeffect-vs-uselayouteffect-examples/)
[hooks-reference.html#uselayouteffect](https://reactjs.org/docs/hooks-reference.html#uselayouteffect)

0 comments on commit 6b69852

Please sign in to comment.