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+
Related
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
Hello there I am getting some error in my terminal and its say i need to use 4.4.0 version and my current version is ...
In my project my current typescript version is given below,
"typescript": "^4.4.2",
"typedoc": "^0.21.8",
"react-scripts": "^3.4.4",
"#typescript-eslint/eslint-plugin": "^4.29.3",
"#typescript-eslint/parser": "^4.29.3",
Moreover, when I am trying to run npm run dev commands or npx eslint . is error are showing me which is given below,
=============
WARNING: You are currently running a version of TypeScript which is not
officially supported by #typescript-eslint/typescript-estree.
You may find that it works just fine, or you may not.
SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <4.4.0
YOUR TYPESCRIPT VERSION: 4.4.2
Please only submit bug reports when using the officially supported
version.
=============
How can i fix this issue and I have done a lot of research in google but nothing is working. It would be great help for me.
I wouldn't downgrade my Typescript, as you will miss out on newer TS features - I would find a way to update #typescript-eslint/typescript-estree.
You might not have this installed directly and this might be a dependancy of another package, #typescript-eslint/experimental-utils which is dependancy of #typescript-eslint/eslint-plugin for instance, so track down the parent package in your yarn.lock / package.lock file and bump it, as a result it should bump #typescript-eslint/typescript-estree too.
Try using a typescript version between >=3.3.1 <4.4.0.
Here you have the list of typescript versions available.
After changing the version, remove node_modules folder and package-lock.json file. Then execute npm install
I'm working on a react project in typescript (react version 16.12.0) and I would like to add React Testing Library to this. The newer versions of react comes with React-Testing-Library but the project I'm working on doesn't come with RTL, so I installed it manually.
I added the below to package.json and did yarn install
"#types/testing-library__react": "^10.2.0",
When I did yarn start, I get this error below
Other related packages versions used
"#types/react": "~16.9.14",
"typescript": "3.4.5",
"react-scripts": "^3.0.0",
The issue was occurring with the typescript version. After some research, I found that for react-testing-library to work with typescript, the TS version needs to be updated to 3.8 and above.
After updating typescript version to 3.8 and fixing some of the errors caused by this update, I was able to resolve this error.
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.
I just connect the app with redux and react-redux connect function, together with state and dispatches. It compiled without problems but the results are not showing. And it looks like below.
I tried to find it and found that i have to change react version.
$ sudo npm install --save react#16.4.0 react-dom#16.4.0
But it didn't work.
I am following this tutorial.
https://www.youtube.com/watch?v=BxzO2M7QcZw
you're using wrong version of React, React.memo is introduced with version 16.6.0 so, try this command to install the right version
npm install --save react#16.6.0 react-dom#16.6.0
for more info click here
This had happened to me as well. This happens when dependencies version gets updated, and the dependencies of the YouTube video you are watched has an old version.
Hence, replace the following dependencies in the package.json file:
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"redux": "^4.0.0",
"redux-thunk": "^2.3.0",
and run npm install.
Since the connect() function connects a React component to a Redux store,
react, redux need to be version supported. If you are willing to use newest dependencies please refer the Redux documentation.
The above method should solve your problem.
That's because #material-ui/styles has a peer dependency on react >= 16.7.0-alpha.0 and react-dom >= 16.7.0-alpha.0 that include hooks.
To use #material-ui/styles, change your react and react-dom dependencies like this:
"dependencies": {
...
"react": "^16.7.0-alpha.2",
"react-dom": "^16.7.0-alpha.2",
...
},
Find out which version of react-redux version you are using and then go to https://react-redux.js.org/versions. Click on the documentation associated with your version. You should see something like this:
Installation
React Redux 7.1 requires React 16.8.3 or later.
Update your react in package.json to the appropriate version and install.