[英][官方] react-redux 6.0 发布

2018-12-07 admin

<g-emoji fallback-src=“https://assets-cdn.github.com/images/icons/emoji/unicode/1f389.png”>🎉</g-emoji> This is our first big release supporting the new Context API added in React 16.4! No more blocked updates!

As such, we now require React 16.4 or higher. Make sure to update your version when updating to this release.

This work has been mostly lead by @cellog and @markerikson, with special guest appearances by yours truly and a whole cast of helpful reviewers.

Note: If you’d like to know more about the changes in v6, and how the implementation has changed over time, see Mark’s post Idiomatic Redux: The History and Implementation of React-Redux.

Breaking Changes

  • The withRef option to connect has been replaced with forwardRef. If {forwardRef : true} has been passed to connect, adding a ref to the connected wrapper component will actually return the instance of the wrapped component. (Known issue: Redux Form currently relies on withRef.)

  • Passing store as a prop to a connected component is no longer supported. Instead, you may pass a custom context={MyContext} prop to both <Provider> and <ConnectedComponent>. You may also pass {context : MyContext} as an option to connect.

Behavior Changes

Any library that attempts to access the store instance out of legacy context will break, because we now put the store state into a <Context.Provider> instead. Examples of this include connected-react-router and react-redux-subspace. (The current implementation does also put the store itself into that same context. While accessing the store in context is not part of our public API, we will still try to make it possible for other libraries to access it, with the understanding that this could break at any time.)

Also, there is a behavior change around dispatching actions in constructors / componentWillMount. Previously, dispatching in a parent component’s constructor would cause its children to immediately use the updated state as they mounted, because each component read from the store individually. In version 6, all components read the same current store state value from context, which means the tree will be consistent and not have “tearing”. This is an improvement overall, but there may be applications that relied on the existing behavior.



转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]


文章标题:[英][官方] react-redux 6.0 发布

Angular 6 正式发布,新功能详解
作者|Stephen Fluin编译|覃云今天,Angular 6.0.0 正式发布,新版本重点关注工具链以及工具链在 Angular 中的运行速度问题。 这次更新还包括框架包(@angular/core、@angular/common、@...
方法一: function replaceStr(str){ &#x2F;&#x2F; 正则法 str = str.toLowerCase(); var reg = &#x2F;\b(\w)|\s(\w)&#x2F;g; &#x2F;&...
如果你在两个月前问我对React的看法,我很可能这样说: 我的模板在哪里?javascript中的HTML在做些什么疯狂的事情?JSX开起来非常奇怪!快向它开火,消灭它吧! 那是因为我没有理解它. 我发誓,React 无疑是在正确的轨道...
Yarn v0.24.2 发布,新型 Javascript 包管理器
Yarn 是 Facebook 贡献 Javascript 包管理器,用于替代现有的 npm 客户端或者其他兼容 npm 仓库的包管理工具。Yarn 保留了现有工作流的特性,优点是更快、更安全、更可靠。 特性: 极速:Yarn 缓存它下载...
相信有很多Linux爱好者心中都怀有编出一个自己的操作系统的理想,一位外国网友在quora上提出了这个问题。本期#linuxstory 说#节目翻译节选了一个令人启迪的回答,让我们从另一个角度思考个人重新发明轮子的意义。以下是网友的答案: ...
之前一直都是在用vue,这两个月换了个公司,不过现在又离职了,这里什么框架都用, vue、angular、react,一般公司都是选二项技术去开发已经就够了, 要不是vue+angular或是react+angular个人觉得用了vue还来...
先来看下Demo LiveDemo 关于开发Vue插件的几种方式 (具体请移步官网)Vue官网 MyPlugin.install = function (Vue, options) { &#x2F;&#x2F; 1\. 添加全局方法或...
本文介绍了react.js使用webpack搭配环境的入门教程,分享给大家,也给自己做个笔记 如果你想直接上手开发,而跳过这些搭配环境的繁琐过程,推荐你使用官方的create-react-app命令 npm install -g creat...
微博发布功能,可发布可删除。样式没设置忽略,主要知识点及注意点: 1、动态添加节点标签。 2、内容为空时不能发布。 3、新发布的内容要在上面。 4、内容删除要同时删除掉节点。 5、为保持样式输入框要设置为不可拖拽。 &lt;!DOCTYPE...
vue下使用 pdf.js 预览 和 打印 PDF文档 兼容React
我使用前端开发框架是vue,有一个打印PDF文档的需求. 这个需求最开始是交给后台,但是明显不切实际, 因为后台服务器,根本就无法连接打印机. 所以这个预览加打印文档的需求就交到了前端, 开始我有想过直接打开pdf文件, 但事实上直接打开p...