blog
blog copied to clipboard
记一次升级 React
https://nanyang.io/post/upgrade-react-16
Why
React
目前最新的公开版本为 16.7
,而 目前项目版本为 15.5
。
对比有如下重要变化:
新核心架构:Fiber (16.0)
异步渲染:周期性地对浏览器执行调度渲染工作的策略。 通过异步渲染,避免阻塞了主线程,实施更快地响应。
异步渲染能够将渲染任务划分为多块,这意味着几乎所有的行为都是同步发生的。 React 16.X 使用浏览器提供....
Gitalk_https://nanyang.io/post/upgrade-react-16
虽然可能有点晚,不过,getDerivedStateFromProp
其实是可以拿到 this 的,只是需要在构造时 state = { self: this , ...otherState}
@iheyunfei 虽然可能有点晚,不过,
getDerivedStateFromProp
其实是可以拿到 this 的,只是需要在构造时state = { self: this , ...otherState}
Nice trick! Got it. 我想原文的描述含义更多的是 限制访问 this 的方式获取 instance 的 props or state