[英][官方] 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.

原文链接:https://github.com/reduxjs/react-redux/releases/tag/v6.0.0

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

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

本文地址:https://www.javascriptcn.com/read-47520.html

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

相关文章
javascript实现英文首字母大写
方法一: function replaceStr(str){ &#x2F;&#x2F; 正则法 str = str.toLowerCase(); var reg = &#x2F;\b(\w)|\s(\w)&#x2F;g; &#x2F;&...
2017-03-22
VSCode配置react开发环境的步骤
vscode 默认配置对于 react 的 JSX 语法不友好,体现在使用自动格式化或者粘贴后默认缩进错误,尽管可以通过改变 language mode 缓解错误,但更改 language mode 后的格式化依然不够理想。 通过搭配使用 ...
2017-12-28
Yarn v0.24.2 发布,新型 Javascript 包管理器
Yarn 是 Facebook 贡献 Javascript 包管理器,用于替代现有的 npm 客户端或者其他兼容 npm 仓库的包管理工具。Yarn 保留了现有工作流的特性,优点是更快、更安全、更可靠。 特性: 极速:Yarn 缓存它下载...
2017-05-08
深入理解JavaScript的React框架的原理
如果你在两个月前问我对React的看法,我很可能这样说: 我的模板在哪里?javascript中的HTML在做些什么疯狂的事情?JSX开起来非常奇怪!快向它开火,消灭它吧! 那是因为我没有理解它. 我发誓,React 无疑是在正确的轨道...
2017-03-26
如果我实现了自己的OS,我算开发者中的精英吗?
相信有很多Linux爱好者心中都怀有编出一个自己的操作系统的理想,一位外国网友在quora上提出了这个问题。本期#linuxstory 说#节目翻译节选了一个令人启迪的回答,让我们从另一个角度思考个人重新发明轮子的意义。以下是网友的答案: ...
2015-12-25
一个适合新手的react小demo
之前一直都是在用vue,这两个月换了个公司,不过现在又离职了,这里什么框架都用, vue、angular、react,一般公司都是选二项技术去开发已经就够了, 要不是vue+angular或是react+angular个人觉得用了vue还来...
2018-01-11
webpack入门+react环境配置
本文介绍了react.js使用webpack搭配环境的入门教程,分享给大家,也给自己做个笔记 如果你想直接上手开发,而跳过这些搭配环境的繁琐过程,推荐你使用官方的create-react-app命令 npm install -g creat...
2017-03-20
js实现微博发布小功能
微博发布功能,可发布可删除。样式没设置忽略,主要知识点及注意点: 1、动态添加节点标签。 2、内容为空时不能发布。 3、新发布的内容要在上面。 4、内容删除要同时删除掉节点。 5、为保持样式输入框要设置为不可拖拽。 &lt;!DOCTYPE...
2017-03-11
从开发到发布一款基于Vue2x的图片预览插件
先来看下Demo LiveDemo 关于开发Vue插件的几种方式 (具体请移步官网)Vue官网 MyPlugin.install = function (Vue, options) { &#x2F;&#x2F; 1\. 添加全局方法或...
2018-05-14
超级给力的JavaScript的React框架入门教程
React 是 Facebook 里一群牛 X 的码农折腾出的牛X的框架。 实现了一个虚拟 DOM,用 DOM 的方式将需要的组件秒加,用不着的秒删。React 扮演着 MVC 结构中 V 的角色, 不过你要是 Flux 搭配使用, 你就有...
2017-03-27
回到顶部