update strategy for npm packages of expo - reactjs

I wonder what the update strategy for expo is when using expo-cli.
F.e. my package currently consists of these packages:
"expo": "39.0.4",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.4.tar.gz",
"react-native-gesture-handler": "1.7.0",
"react-native-reanimated": "1.13.1",
"react-native-web": "0.14.8",
Normally when i do default react applications i just add renovate-bot to my repo and update everything all the time. Things seem to be different when using expo. Some questions:
When i updated react-native-gesture-handler or react-native-reanimated i got warnings when running expo start that these versions are out of range for my currently running expo package. Is it correct that i should not update those dependend packages until expo releases an update?
When i updated react to 17 no such warning popped up, so it seems expo is fine when i run newer version of react? (although i had other runtime warnings pop up related to it)
Why is react-native fixed to this specific version? I guess because expo expects an exact version? Is this when expo upgrade should be used once a new expo version gets released?
Thanks for answering any of these questions.

Related

Type issue in build with sharp in Next.js app

In the image below, I can't yarn build the app.
I'm using Plaiceholder that depends on Sharp.
Everything is working fine, but when I build the app it crashes.
Versions that I'm using:
"react": "17.0.2"
"next": "12.1",
"sharp": "^0.31.0",
"#types/sharp": "^0.31.0",
You're most likely on a TypeScript version that does not support the type modifier on named imports, which has been introduced in TypeScript 4.5.
Make sure you're at least on TypeScript v4.5.
yarn add typescript#4.5.5
Or better yet, try to update to the latest TypeScript version if you can.
yarn add typescript#latest

Unable to run eslint in Next.js

I'm trying to set up eslint on my Next.js project. I followed the guide here https://nextjs.org/docs/basic-features/eslint
When I run yarn lint, I receive the error error - ESLint must be installed.
In my "devDependencies" in package.json, I have the following:
"eslint": "^8.0.1",
"eslint-config-next": "11.1.2"
I tried running yarn add --dev eslint, but I still receive the same error after running the lint command.
Edit:
This is an existing project. Was created with yarn create next-app.
Versions for next and react below
"next": "^11.1.2",
"react": "^17.0.2"
Node v14.18.1
ESLint v8 introduced breaking changes that impact compatibility with Next. Downgrading to 7.32.0 seems to work for most people.
The Next team is currently working on adding v8 support.

Can I safely update react and react-dom without updating react-scripts?

I have used CRA on a project for 2 years now.
Currently, my packages are on the following outdated versions but I want to update to React 16.8 because it's a peer-dependency for a lot of npm packges I want to use.
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-router-dom": "^4.2.2",
"react-scripts": "1.1.0",
Can I safely update react and react-dom to 16.8 without updating react-scripts?
Note, I tried updating CRA (react-scripts) to 2.x.x recently and it caused a bunch of my older libraries to fail.
I wouldn't recommend, unless there is a need on it. (Like a security breach)
You probably will find some compatibility issues, and for this to work, you will need to update your dependencies.

React.default.memo is not a function (React-Native) wrapWithConnect

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)
I had the same problem and I changed the version of react-redux to 6.0.0 instead of using a more recent one, and the issue was resolved.
You can change the version by running following command:
npm install react-redux#6.0.0.
My project version is greater than 16.5.0 but I am unsure if this also has an impact or not.
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
Try using react 16.6.0 instead of 16.5.0
This is issue with expo.Try to clear expo cache by using this command
expo r -c
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.
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 support react 16.8
react-redux 7.1 and on require react 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.
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.

create-react-app using old version of react

I'm using create-react-app and have updated react and react-dom to later versions, yet when I console log the version of react being used, it's still showing an older version.
package.json
"react": "^16.3.0",
...
"react-dom": "^16.3.0",
Then I log the version used:
console.log('React.version', React.version);
And it tells me:
React.version 15.6.2
How can I get create-react-app to use the newer version?
Reason for update, I want to use React Context which is only available from version 16.3.0+

Resources