Home >Web Front-end >Front-end Q&A >How to change the version of react native

How to change the version of react native

藏色散人
藏色散人Original
2023-01-19 14:31:191772browse

How to change the version of react native: 1. Enter the React Native project directory and enter "react-native --version" on the command line; 2. Check the React Native version managed by npm package; 3. Open the project In the "package.json" file, modify the dependencies field and change the "react-native" version to the target version.

How to change the version of react native

The operating environment of this tutorial: Windows 10 system, react18.0.0 version, Dell G3 computer.

How to change the version of react native?

React Native version upgrade and downgrade

Manually modify the configuration file to update

1. Check the local React Native version

Enter the React Native project directory and enter on the command line

react-native --version

How to change the version of react native

2. Check the React Native version managed by npm package

Method 1. React managed by npm The Native package address is: https://www.npmjs.com/package/react-native

Method 2. Enter npm info react-native

How to change the version of react native

# on the command line ##3. Change the package.json configuration

Open the package.json file in the project, modify the dependencies field, and change the react-native version to the target version

How to change the version of react native

4. Switch the project home directory

npm install

How to change the version of react native

Version change successful

Run npm intall --save command in the project to install react-native new Version

npm install --save react-native@版本号

Change project templates

With different versions, the build project template also changes. Execute the following command to update the project templates

react-native upgrade

Recommended learning: "

react video tutorial"

The above is the detailed content of How to change the version of react native. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn