英文:
react native upgrade from version 0.61.1 to the latest stable version in the 70 series
问题
我目前正在进行一个React Native项目,并计划从版本0.61.1升级到70系列的最新稳定版本。我希望能够得到一些关于升级过程的指导和建议。
以下是我的具体问题:
在存在显著版本差距时,升级React Native的推荐方法是什么?我应该逐步升级,还是可以直接跳到70系列的最新版本?
您建议从0.61.0升级到70系列的哪个稳定版本?我需要注意哪些已知问题或考虑事项?
升级版本
我打算升级到0.72.0。
关于这次升级的任何提示、见解或个人经验将不胜感激。
提前谢谢!
英文:
I'm currently working on a React Native project and planning to upgrade from version 0.61.1 to the latest stable version in the 70 series. I would appreciate some guidance and recommendations regarding the upgrade process.
Here are my specific questions:
What is the recommended approach to upgrading React Native when there is a significant version gap? Should I upgrade step by step or can I directly jump to the latest version in the 70 series?
Which stable version in the 70 series would you suggest for upgrading from 0.61.0? Are there any known issues or considerations I should be aware of?
Upgrading Version
I'm looking to upgrade to 0.72.0.
Any tips, insights, or personal experiences related to this upgrade would be highly appreciated.
Thank you in advance!
答案1
得分: 3
你可以使用升级助手工具。
升级助手是一个Web工具,它可以在升级应用程序时帮助你,提供在任意两个版本之间发生的所有更改。它还显示特定文件的注释,以帮助理解为什么需要进行这些更改。
- 选择版本
首先,您需要选择要升级的起始版本和目标版本,默认情况下选择最新的主要版本。选择后,您可以点击“Show me how to upgrade”按钮。
注意:主要更新将在顶部显示一个“有用的内容”部分,其中包含帮助您在升级时的链接。
- 升级依赖项
首先显示的文件是package.json
,更新其中显示的依赖项是很好的做法。例如,如果react-native
和react
出现为更改项,您可以通过运行yarn add
或npm install
将其安装到您的项目中:
yarn add react-native@{{VERSION}}
yarn add react@{{REACT_VERSION}}
{{VERSION}}
和{{REACT_VERSION}}
是显示在差异中的版本号。
- 升级项目文件
新版本可能包含在运行npx react-native init
时生成的其他文件的更新,这些文件在升级助手页面的package.json
之后列出。如果没有其他更改,那么您只需要重新构建项目以继续开发。
如果有更改,您可以通过从页面中的更改复制和粘贴来手动更新它们,或者可以使用React Native CLI的升级命令进行更新,方法是运行:
npx react-native upgrade
英文:
you can use the Upgrade Helper tool.
>The Upgrade Helper is a web tool to help you out when upgrading your apps by providing the full set of changes happening between any two versions. It also shows comments on specific files to help understanding why that change is needed.
1. Select the versions
You first need to select from and to which version you wish to upgrade, by default the latest major versions are selected. After selecting you can click the button "Show me how to upgrade".
> note: Major updates will show an "useful content" section on the top with links to help you out when upgrading.
2.Upgrade dependencies
The first file that is shown is the package.json
, it's good to update the dependencies that are showing in there.<br> For example, if react-native
and react
appears as changes then you can install it in your project by running yarn add or npm install:
yarn add react-native@{{VERSION}}
yarn add react@{{REACT_VERSION}}
{{VERSION}}
and {{REACT_VERSION}}
are the release versions showing in the difference there.
3.Upgrade your project files
The new release may contain updates to other files that are generated when you run npx react-native init
, those files are listed after the package.json
in the Upgrade Helper page.<br> If there aren't other changes then you only need to rebuild the project to continue developing.
In case there are changes then you can either update them manually by copying and pasting from the changes in the page or you can do it with the React Native CLI upgrade command by running:
npx react-native upgrade
答案2
得分: 2
您可以使用 升级助手 工具来升级您的React Native版本。
这是一个网络工具,可通过使用React Native的源版本和目标版本来帮助您升级React Native。
⚙️ 如何使用
手动
- 打开 https://react-native-community.github.io/upgrade-helper/
- 选择
源版本
和目标版本
- 复制差异更改到您的项目中
- 根据与React Native版本兼容的版本更新react-native包
自动
您可以使用此CLI来升级
npx react-native upgrade
注意: 通过此命令,您可能会遇到合并冲突,需要手动解决。
注意: 在更新应用程序之前,请先备份您的项目
英文:
You can use Upgrade Helper Tool to upgrade your React Native version
it is a web tool to help you upgrade your React Native by using source and target version of react native
⚙️ How to use
Manual
- open https://react-native-community.github.io/upgrade-helper/
- choose
source version
anddestination version
- copy diff changes into your project
- update react-native packages by seeing the compatible version with React native version
Automatic
you can use this cli to upgrade
npx react-native upgrade
Note: by this command, you can get merge conflicts which you have to resolve manually
Note: Backup your project first before updating your app
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论