Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

精读《React 的新特性》 #115

Closed
twobin opened this issue Dec 4, 2018 · 2 comments
Closed

精读《React 的新特性》 #115

twobin opened this issue Dec 4, 2018 · 2 comments

Comments

@twobin
Copy link
Contributor

twobin commented Dec 4, 2018

阅读 react blog 文章 React 16.x Roadmap

一起来分析下 suspense、concurrent rendering、hooks、lazy、memo、contextType、fiber、new lifecycles and context API 等一系列 16 新特性。

@Tan90Qian
Copy link

React Call Return (Experimental)
This experiment was deleted because it was affecting the bundle size and the API wasn't good enough. It's likely to come back in the future in some other form. (@gaearon in #12820)

16.1新增的react-call-return包因为不够好用而在16.4被移除了(难怪说怎么完全没有这俩api的印象)

@Tan90Qian
Copy link

memo
React.memo() 只能作用在简单的函数组件上,本质是一个高阶函数,可以自动帮助组件执行 shouldComponentUpdate(),但只是执行浅比较,其意义和价值有限。

在React.memo出现前,由于函数式组件没有生命周期,所以其父组件发生re-render时必定会造成函数式组件的re-render,哪怕其接收的props没有变化。
出于这个原因,“逻辑-UI分离”的组件设计方案中,不得不将UI组件以PureComponent的class组件形式进行定义,哪怕该组件没有任何定义任何state、生命周期钩子、组件方法。
而React.memo出现后,可以减少不必要的class组件定义了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants