问题描述
我真的在一小时前开始阅读 ReactNative 并且正在阅读这个 git readme https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md
I literally started reading about ReactNative an hour ago and am reading this git readme https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md
接下来我用谷歌搜索了它,发现这个链接似乎在解释它,但对我来说不是网络、反应或反应原生的新手https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md
Next I googled about it and found this link which seem to be explaining it but not to me novice in web, react, or react-nativehttps://github.com/react-community/create-react-native-app/blob/master/EJECTING.md
有人可以像我2岁一样向我解释eject是什么意思吗?我一直听到被驱逐的项目"这个词,但我无法理解它.
Can someone explain to me as if I am 2 years old what is the meaning of eject? I keep hearing term "ejected project" but I cannot wrap my head around it.
推荐答案
总结
如果您使用 create-react-native-app MyApp
创建了一个应用程序,弹出您的应用程序将使您的应用程序与您使用 react-native init MyApp 创建您的项目相同
Summary
If you created an app using create-react-native-app MyApp
, ejecting your app gets your app to be the same as if you created your project using react-native init MyApp
又名
create-react-native-app MyApp
> 更改应用程序 > 弹出应用程序
create-react-native-app MyApp
> make changes to app > eject app
大致相当于
react-native init MyApp
> 修改应用程序
create-react-native-app MyApp
和 react-native init MyApp
有什么区别?
create-react-native-app 背后的理念是:
The philosophy behind create-react-native-app is:
- 最短的Hello World 时间":创建 React Native App 应该将尝试构建移动应用程序所需的设置时间减少到绝对最短,理想情况下与 React Web 开发相当(尤其是作为见 Create React App).
- 在您的设备上开发:当您想要测试您的应用对输入的感受和响应时,在物理设备上开发应该很容易.
- 一个构建工具:如果您只是想开始使用 React Native,则不需要安装 Xcode、Android Studio、NDK 或弄乱环境变量.
- 无锁定:如果您需要编写自定义本机代码或修改应用的构建方式,您可以随时弹出"到您自己的构建设置.
本质上,create-react-native-app 可让您快速启动并运行而无需进行大量(或任何)配置.为了做到这一点,它对你隐藏了很多细节.
Essentially, create-react-native-app lets you get up and running quickly without having to a do a lot of (or any) configuration. In order to do this, it hides a lot of details from you.
如果你想创建一个严肃的应用程序,你需要设置一个真正的开发环境.您可以通过运行 react-native init
从头开始执行此操作.如果您从使用 create-react-native-app 的 React Native 项目开始,您可以通过弹出"您的应用程序来达到同样的目的
If you want to create a serious app, you need to set up a real development environment. You can do this from scratch by running react-native init <project-name>
. If you started with a react native project using create-react-native-app, you can get to this same place by "ejecting" your app
有关 React Native 入门的官方文档的更多详细信息可以在 这里.
More details from the official documentation about getting started with React Native can be found here.
这篇关于ReactNative Eject 解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!