javascript - _react.default.memo 不是函数 | wrapWithConnect 问题

标签 javascript reactjs react-native redux react-redux

使用 connect()(Component) 包装组件时,我的 React Native 应用程序出现错误。 "_react.default.memo 不是函数(在 _react.default.memo(ConnectFunction) 中,_react.default.memo 未定义。我该如何解决这个问题?

Screenshot of the error

我认为这个问题是基于我的 React 和 Redux 版本号。但我无法找到罪魁祸首。此应用程序处于非常早期的开发阶段,但也许我只是忘了将某些东西与我的商店连接起来。

目前我的 package.json 版本如下

  "dependencies": {
    "expo": "^32.0.6",
    "react": "^16.8.6",
    "react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
    "react-navigation": "^3.8.1",
    "react-redux": "^7.0.2",
    "redux": "^4.0.1"
  },
  "devDependencies": {
    "babel-preset-expo": "^5.1.1",
    "schedule": "^0.4.0"
  }

我已经尝试将 react-redux 回滚到 6.0.0 并按照 this thread 中的描述对 16.5.0 使用react但是,我得到了一个不同的错误。

Unable to resolve "./utils/batch" from "node_modules/react-redux/lib/index.js"

我已经尝试卸载并重新安装 react-redux。 (包括删除文件夹)。我什至没有在该 index.js 文件中看到对 utils/batch 的调用。

如有任何帮助,我们将不胜感激。该组件在添加 connect 之前正确呈现。调用 export default connect()(ComponentName) 时发生异常。

如果需要,可以找到我的存储库 here .不过,从那时起,我就开始研究这些版本。

最佳答案

切换到 React Redux 6.0.0 npm install react-redux@6.0.0

为了摆脱 Unable to resolve "./utils/batch"from "node_modules/react-redux/lib/index.js"

使用 expo r -c 清除 expo 缓存。

https://forums.expo.io/t/how-to-clear-the-react-native-packager/1352

关于javascript - _react.default.memo 不是函数 | wrapWithConnect 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55665828/

相关文章:

javascript - 带图像切换的下拉菜单

node.js - Node 错误: resolve-url-loader: CSS error

node.js - Next.JS - `.htaccess` 文件?

react-native - (React Native) 横向锁屏

react-native - 显示存储在手机上的图像

php - 在跨域 ajax 请求后保留 cookie

声明 DOCTYPE 时,Javascript 在 Chrome 中不起作用

reactjs - 我如何使用 react native 中的选择器从 redux 状态设置 usestate 的初始值?

javascript - 为编辑表单创建重置功能

javascript - 在 React Native 中设置自定义开发者选项