技术控

    今日:68| 主题:49103
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] React Implementation Notes

[复制链接]
软妹子 发表于 2016-10-11 04:14:59
118 1

立即注册CoLaBug.com会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
Implementation Notes

   This section is a collection of implementation notes for thestack reconciler.
   It is very technical and assumes a strong understanding of React public API as well as how it's divided into core, renderers, and the reconciler. If you're not very familiar with the React codebase, read the codebase overview first.
   The stack reconciler is powering all the React production code today. It is located in  src/renderers/shared/stack/reconciler  and is used by both React DOM and React Native.
  Video: Building React from Scratch

   Paul O'Shannessy gave a talk about building React from scratch that largely inspired this document.
  Both this document and his talk are simplifications of the real codebase so you might get a better understanding by getting familiar with both of them.
  Overview

   The reconciler itself doesn't have a public API.Renderers like React DOM and React Native use it to efficiently update the user interface according to the React components written by the user.
  Mounting as a Recursive Process

  Let's consider the first time you mount a component:
  [code]ReactDOM.render(, rootEl);[/code]   React DOM will pass along to the reconciler. Remember that is a React element, that is, a description of what to render. You can think about it as a plain object:
  [code]console.log();
// { type: App, props: {} }[/code]   The reconciler will check if App is a class or a function.
   If App is a function, the reconciler will call App(props) to get the rendered element.
   If App is a class, the reconciler will instantiate an App with new App(props) , call the componentWillMount() lifecycle method, and then will call the render() method to get the rendered element.
   Either way, the reconciler will learn the element App "rendered to".
   This process is recursive. App may render to a , Greeting may render to a
友荐云推荐




上一篇:Futures/Promises 概览:我是如何爱上 GCD 的
下一篇:Using The FCC EAS For Fun And Profit
酷辣虫提示酷辣虫禁止发表任何与中华人民共和国法律有抵触的内容!所有内容由用户发布,并不代表酷辣虫的观点,酷辣虫无法对用户发布内容真实性提供任何的保证,请自行验证并承担风险与后果。如您有版权、违规等问题,请通过"联系我们"或"违规举报"告知我们处理。

シ尊嚴的色調 发表于 2016-10-17 01:25:54
楼主说的,句句都是真理啊!
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

我要投稿

推荐阅读

扫码访问 @iTTTTT瑞翔 的微博
回页顶回复上一篇下一篇回列表手机版
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 )|网站地图 酷辣虫

© 2001-2016 Comsenz Inc. Design: Dean. DiscuzFans.

返回顶部 返回列表