React 16.3.0 已发布,React 是 Facebook 推出的一个为数据提供渲染为 HTML 视图,用来构建用户界面的开源 库。
React 视图通常采用包含以自定义 HTML 标记规定的其他组件的组件渲染。React 为程序员提供了一种子组件不能直接影响外层组件("data flows down")的模型,数据改变时对 HTML 文档的有效更新,和现代单页应用中组件之间干净的分离。
更新内容:
React
- Add a new officially supported context API
- Add a new
React.createRef()API as an ergonomic alternative to callback refs. - Add a new
React.forwardRef()API to let components forward their refs to a child. - Fix a false positive warning in IE11 when using
React.Fragment - Replace
React.unstable_AsyncComponentwithReact.unstable_AsyncMode - Improve the error message when calling
setState()on an unmounted component.
React DOM
- Add a new
getDerivedStateFromProps()lifecycle andUNSAFE_aliases for the legacy lifecycles. - Add a new
getSnapshotBeforeUpdate()lifecycle - Add a new
<React.StrictMode>wrapper to help prepare apps for async rendering. - Add support for
andevents on the< >tag - Add support for
noModuleboolean attribute on the< >tag - Fix minor DOM input bugs in IE and Safari
- Correctly detect Ctrl + Enter in
in more browsers - Fix containing elements getting focused on SSR markup mismatch
- Fix
valueanddefaultValueto ignore Symbol values - Fix refs to class components not getting cleaned up when the attribute is removed.
- Throw with a meaningful message if the component runs after jsdom has been destroyed.
- Don't crash if there is a global variable called
operawith anullvalue - Don't check for old versions of Opera
- Deduplicate warning messages about
<option selected> - Deduplicate warning messages about invalid callback
- Deprecate
ReactDOM.unstable_createPortal()in favor ofReactDOM.createPortal(). - Don't emit User Timing entries for context types
- Improve the error message when context consumer child isn't a function.
- Improve the error message when adding a ref to a functional component.
React DOM Server
- Prevent an infinite loop when attempting to render portals with SSR.
- Warn if a class doesn't extend
React.Component. - Fix an issue with
this.stateof different components getting mixed up. - Provide a better message when component type is undefined.
React Test Renderer
- Fix handling of fragments in
toTree(). - Shallow renderer should assign state to
nullfor components that don't set it. - Shallow renderer should filter legacy context according to
contextTypes. - Add an unstable API for testing asynchronous rendering.
React Is (New)
- First release of the new package that libraries can use to detect different React node types.
- Add
ReactIs.isValidElementType()to help higher-order components validate their inputs.
React Lifecycles Compat (New)
- First release of the new package to help library developers target multiple versions of React.
Create Sub ion (New)
- First release of the new package to subscribe to external data sources safely for async rendering.
React Reconciler (Experimental)
- Expose
react-reconciler/persistentfor building renderers that use persistent data structures. - Pass host context to
finalizeInitialChildren(). - Remove
useSyncSchedulingfrom the host config.
React Call Return (Experimental)
- Fix a crash on updates.
继续阅读与本文标签相同的文章
上一篇 :
VueCli3构建TS项目的方法步骤
下一篇 :
PHP校验15位和18位身份证号的类封装
-
免费的分布式事务来了——阿里巴巴Fescar
2026-05-19栏目: 教程
-
升级iOS 13后真能随意换字体?库克言:想多了,字体管理≠换字体
2026-05-19栏目: 教程
-
Java发送邮件必带超时时间配置
2026-05-19栏目: 教程
-
学术研究显示:移动支付让人花钱更多,是真的吗?
2026-05-19栏目: 教程
-
腾讯营收5.99亿美元登顶9月全球移动发行商收入总榜 同比增30%
2026-05-19栏目: 教程
