【问题标题】:React-native and react-redux conflict on different version of reactReact-native 和 react-redux 在不同版本的反应上发生冲突
【发布时间】:2019-04-10 01:52:08
【问题描述】:
我在安装 react-redux 时遇到问题。我在这里复制并粘贴了问题。在一个项目中同时拥有 2 个版本的 react-native 是否合理?
react-native 说:
WARN react-native@0.59.4 需要 react@16.8.3 的对等点,但没有安装。您必须自己安装对等依赖项。
react-redux 说:
警告 react-redux@7.0.1 需要 react@^16.8.4 的对等点,但没有安装。您必须自己安装对等依赖项。
通过安装 16.8.3,react-redux 将寻找 16.8.4。另一方面,react-redux 不适用于 16.8.3,需要 16.8.4。如何解决问题?
【问题讨论】:
标签:
reactjs
react-native
redux
react-redux
【解决方案1】:
好的,我找到了原因。 22 小时前 react-redux 已更新到 7.0.1,正如其文档所述:The major change for this release is that connect is now implemented using Hooks internally. Because of this, we now require a minimum React version of 16.8.4 or higher. 它至少需要 16.8.4。所以现在最好的解决方案是通过以下方式安装 react-redux 6.0.1 版:
npm install --save react-redux@6.0.1