不同版本的React上的React-native和react-redux冲突

时间:2019-04-10 01:52:09

标签: reactjs react-native redux react-redux

我在安装react-redux时遇到问题。我在这里复制并粘贴了问题。在一个项目中同时拥有两个版本的react-native是否合理?

react-native说:WARN react-native@0.59.4 requires a peer of react@16.8.3 but none is installed. You must install peer dependencies yourself.

react-redux说:WARN react-redux@7.0.1 requires a peer of react@^16.8.4 but none is installed. You must install peer dependencies yourself.

通过安装16.8.3,react-redux将查找16.8.4。另一方面,react-redux不适用于16.8.3,并且需要16.8.4。如何解决问题?

1 个答案:

答案 0 :(得分: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