Foxifly
Foxifly

Reputation: 41

_react.default.memo is not a function | wrapWithConnect issues

When wrapping a component with connect()(Component), I am getting an error on my React Native application. "_react.default.memo is not a function (In _react.default.memo(ConnectFunction), _react.default.memo is undefined. How can I resolve this issue?

Screenshot of the error

I believe this issue is based on my version numbers with React and Redux. But I am unable to locate the culprit. This application is in very early development, but perhaps I just forgot to connect something with my store.

Currently my versions from package.json are the following

  "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"
  }

I have tried rolling back react-redux to 6.0.0 and react to 16.5.0 as described in this thread but, I get a different error.

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

I have tried uninstalling and reinstalling react-redux. (including deleting the folder). I don't even see a call to utils/batch inside that index.js file.

Any help would be greatly appreciated. The component renders correctly before connect is added. Exception happens when export default connect()(ComponentName) is invoked.

if needed, my repository is found here. Since then, though, I have toyed with the versions.

Upvotes: 3

Views: 3189

Answers (2)

Mark Long
Mark Long

Reputation: 41

Switching to React Redux 6.0.0 npm install [email protected].

In order to get rid of the Unable to resolve "./utils/batch" from "node_modules/react-redux/lib/index.js"

Clear expo caches with expo r -c.

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

Upvotes: 4

Foxifly
Foxifly

Reputation: 41

I think I was just able to resolve this. I finally caved and installed yarn letting Yarn take over the dependency install seemed to have worked.

My dependencies are running at

"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": "^6.0.0",
    "redux": "^4.0.1"
  },
  "devDependencies": {
    "babel-preset-expo": "^5.1.1",
    "schedule": "^0.4.0"
  },

and my app is back to running with everything acting compatible again. Not sure what was done differently with Yarn. But I am relieved that I got this back up. I hope this helps others!

Upvotes: 1

Related Questions