大 feature 及其 timeline
- (16.0)
Fragments
- (16.0)
ErrorBoundary
- (16.0)
Portal
- (16.3)
Context
API - (16.3) Lifecycle Methods
- (16.6)
React.memo
- (16.6)
React.lazy
&React.Suspence
(for code splitting) - (16.x/Q1 2019) Hooks
- (16.x/Q2 2019) Concurrent Mode
- (16.x/mid 2019) Suspense(for data fetching)
- (2019) Modernizing React DOM
- (2019) Suspense(for Server Side Rendering)
展开思路:
- 是个啥
- 解决了什么问题
- 采用建议
- 迁移建议
- 代码片段
- fragments & strings: no need for a wrapping component
- error boundary
- portal: https://reactjs.org/docs/portals.html - cannot understand
- dom attributes - 这是个很细节的东西。用到再看就好了
- architecture rewrite: https://code.fb.com/web/react-16-a-look-inside-an-api-compatible-rewrite-of-our-frontend-ui-library/
- 是个啥:React 15 以前你在 html 里写 React 不认识的属性是会被直接忽略的
- 解决了什么问题:现在可以写了
- 采用建议:
- 迁移建议
- 代码片段
-
Context
API - 还是不错的东西 -
lifecycle changes:
-
StrictMode
: https://reactjs.org/docs/strict-mode.html -
async rendering:
- https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html
- https://t.co/3snoahB3uV
- pic.twitter.com/egQ988gBjR
-
refs support:
- Pointer events: https://reactjs.org/blog/2018/05/23/react-v-16-4.html
React.memo
:PureComponent
for functional componentsReact.lazy
&React.suspence
(data fetching with Apollo):contextType
https://reactjs.org/blog/2018/11/27/react-16-roadmap.html
- React 16.6 with Suspense for Code Splitting (already shipped)
- A minor 16.x release with React Hooks (~Q1 2019)
- A minor 16.x release with Concurrent Mode (~Q2 2019)
- A minor 16.x release with Suspense for Data Fetching (~mid 2019)
2019 plans:
- Modernizing React DOM: https://reactjs.org/blog/2018/11/27/react-16-roadmap.html#modernizing-react-dom
- Suspense for Server Rendering: https://reactjs.org/blog/2018/11/27/react-16-roadmap.html#suspense-for-server-rendering