来自世博网站
Expo让web开发者只需用JavaScript编写一次,就能构建出能够在iOS和Android上运行的真正原生应用。
这不是React Native所做的吗?有什么不同?
来自世博网站
Expo让web开发者只需用JavaScript编写一次,就能构建出能够在iOS和Android上运行的真正原生应用。
这不是React Native所做的吗?有什么不同?
当前回答
在世博会的官方文件中有解释
Expo和React Native的区别是什么?
Expo is kind of like Rails for React Native. Lots of things are set up for you, so it’s quicker to get started and on the right path. With Expo, you don’t need Xcode or Android Studio. You just write JavaScript using whatever text editor you are comfortable with (Atom, vim, emacs, Sublime, VS Code, whatever you like). You can run XDE (our desktop software) on Mac, Windows, and Linux. Here are some of the things Expo gives you out of the box that work right away: Support for iOS and Android You can use apps written in Expo on both iOS and Android right out of the box. You don’t need to go through a separate build process for each one. Just open any Expo app in the Expo Client app from the App Store on either iOS or Android (or in a simulator or emulator on your computer). Push Notifications Push notifications work right out of the box across both iOS and Android, using a single, unified API. You don’t have to set up APNS and GCM/FCM or configure ZeroPush or anything like that. We think we’ve made this as easy as it can be right now. Facebook Login This can take a long time to get set up properly yourself, but you should be able to get it working in 10 minutes or less on Expo. Instant Updating All Expo apps can be updated in seconds by just clicking Publish in XDE. You don’t have to set anything up; it just works this way. If you aren’t using Expo, you’d either use Microsoft Code Push or roll your own solution for this problem Asset Management Images, videos, fonts, etc. are all distributed dynamically over the Internet with Expo. This means they work with instant updating and can be changed on the fly. The asset management system built-in to Expo takes care of uploading all the assets in your repo to a CDN so they’ll load quickly for anyone. Without Expo, the normal thing to do is to bundle your assets into your app which means you can’t change them. Or you’d have to manage putting your assets on a CDN or similar yourself. Easier Updating To New React Native Releases We do new releases of Expo every few weeks. You can stay on an old version of React Native if you like, or upgrade to a new one, without worrying about rebuilding your app binary. You can worry about upgrading the JavaScript on your own time. But no native modules… The most limiting thing about Expo is that you can’t add in your own native modules without detaching and using ExpoKit.
其他回答
世博会CLI
优点:
无需安装Android Studio或Xcode即可开始构建。 不需要很多配置。 使用条形码扫描在Android和iPhone上轻松查看移动UI。通过在线iPhone和Android模拟器也更容易查看。 更快的设置和开发。
缺点:
无法添加本机依赖项。 创建。apk和。ipa文件是困难的。 apk/ipa的大小很大。
React Native CLI
优点:
轻松添加本机依赖项。 创建。apk和。ipa文件比使用Expo要容易得多
注意:React Native CLI是用来直接使用React Native框架的框架。
缺点:
需要高水平的配置。 基本了解Android和iOS文件夹结构。
如你所见,这两种方法各有利弊;您应该始终根据项目的需要来决定使用哪一种。
Expo and React Native are two popular tools for building mobile apps, but they have some differences. Expo is a free and open-source platform that allows developers to quickly build apps with JavaScript and React Native. It provides a set of tools, libraries, and services that make it easier to get started with building a mobile app. React Native, on the other hand, is a framework for building mobile apps using React. React Native provides a more direct way to access native APIs and components, and allows for more customization and control over the app development process. In summary, Expo provides a faster and easier way to get started with building a mobile app, while React Native provides more control and customization.
Another difference between Expo and React Native is the deployment process. With Expo, you can publish your app directly to the app stores with just a few clicks. You can also take advantage of other services that Expo provides, such as push notifications and authentication. On the other hand, when building a React Native app, you'll need to use tools like Xcode or Android Studio to compile and package the app for deployment. Additionally, you'll have to handle the distribution process yourself, which can be time-consuming and complex.
在性能方面,React Native通常比Expo有更好的性能,因为它可以直接访问本地api和组件,而Expo依赖于它的SDK。然而,在许多情况下,性能差异可能并不显著。
总之,Expo和React Native都有各自的优点和缺点,它们之间的选择取决于项目的具体需求和目标。如果你刚刚开始移动应用程序开发,想要一个快速简单的方法开始,Expo是一个很好的选择。然而,如果你想要更多的控制和定制,React Native可能是更好的选择。
关于Expo和React Native CLI的优点和缺点的答案是完整的。我还想谈谈我的个人经历。
在项目中,默认情况下,Expo包含许多模块,这使得使用它更容易。但它在制作阶段存在一个大问题,因为Android和iOS版本的尺寸太大了。例如,如果你有一个带有“Hello, World!”’,APK文件大小约为19 MB。在React Native CLI中使用相同的项目将导致应用程序大小为6 MB。
所以就我个人而言,如果你想开发一款商业应用,我不建议你使用Expo。
这里我要说明的是,Expo使用的是React的旧版本16.5,这将禁止你使用新的hooks功能。
如果您决定使用Expo,请注意您的版本控制。例如,如果遇到奇怪的错误,就需要在16.5版本中使用旧版本的反应导航。
Expo是React Native CLI的包装,它在底层为开发人员提供方便。Expo解决的最常见的问题是,开发人员不必担心React Native CLI中经常出现的库链接问题。Expo现在提供了大量的库,这些库对健壮的开发非常有帮助。Expo的好处之一是,你可以在没有Mac的情况下通过Expo手机应用开发Android和iOS应用。
虽然它有很多好处,但使用Expo也有一些缺点:
应用程序的大小迅速增加。一个简单的Hello, World!app大小超过30mb 有时候,当你需要在你的应用程序中实现一些本地功能时,你将需要从Expo中弹出并返回React native CLI。而且您永远无法将其恢复到Expo CLI。