问题
I get this the error
_react.default.memo is not a function
and wrapWithConnect
.
This is a react-native
project and it worked fine before I used the connect function to connect my dispatch into my react component:
Package Versions:
"react": "16.5.0",
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
code
const mapDispatchToProps = dispatch => {
return {
sendEmail: (email, navigateMap) => dispatch(sendEmail, navigateMap))
export default connect(null, mapDispatchToProps)(Login)
回答1:
I had the same problem and I changed the version of react-redux
to 6.0.1
instead of using a more recent one, and the issue was resolved.
Please change version by running following command:
npm install react-redux@6.0.1
.
My project version is greater than 16.5.0 but I am unsure if this also has an impact or not.
回答2:
Had this exact same error. Realised it's not due to syntax errors, but the react-redux version compabitility. Once I ran yarn check, it gave me multiple messages that "react-redux#react@^16.8.4 does not satisfy found match of react@16.5.0".
Expo is react 16.5.0 while react-redux expects react version 16.8.4 . As moi answered, installing react-redux 6.0.0 worked for me. Trying to change any other package caused even more errors to appear
回答3:
Try using react 16.6.0 instead of 16.5.0
回答4:
This is issue with expo.Try to clear expo cache by using this command
expo r -c
回答5:
Try update your dependencies.
I have the same problem and I'm using npm-check-updates.
Here's a update check log:
expo ^32.0.0 → ^32.0.6
react 16.5.0 → 16.8.6
react-navigation ^3.6.1 → ^3.7.1
babel-preset-expo ^5.0.0 → ^5.1.1
Run npm install to install new versions.
回答6:
If you are feeling lost and shelterless while trying to implement a modern React-Native inside Expo app, do not worry my friend, you are not alone.
I had this problem and found that:
expo 32.0
does not supportreact 16.8
react-redux 7.1
and on requirereact 16.8
I was able to make it work with this set of versions:
"expo": "^32.0.0",
"react": "16.5.0",
"react-redux": "^6.0.1",
You can replace them in your package.json
, then you should do:
> rm -rf node_modules
> [npm|yarn] install
> expo r -c
In order to remove previous versions from node_modules and Expo cache.
回答7:
To combine the two answers that solved it for me:
- Remove new react-redux:
yarn remove react-redux
- Install the older version of react-redux:
yarn add react-redux@6.0.1
- Clear expo cache:
expo r -c
That will do the trick.
来源:https://stackoverflow.com/questions/55624579/react-default-memo-is-not-a-function-react-native-wrapwithconnect