From the Expo website
Expo lets web developers build truly native apps that work across both iOS and Android by writing them once in just JavaScript.
Isn't this what React Native does? What's the difference?
From the Expo website
Expo lets web developers build truly native apps that work across both iOS and Android by writing them once in just JavaScript.
Isn't this what React Native does? What's the difference?
When you write code in Expo you are writing React Native code. Expo has two main pieces:
Expo CLI (expo-cli
): a developer tool for creating projects, viewing logs, opening on your device, publishing, etc.
Expo client: an app on your phone that lets you open your projects
while you're working on them, without needing to go through XCode or Android Studio, and also lets other people view them too! And if you publish it through expo-cli
, people can access it at any time through the Expo client on Android or on iOS if signed in to the same account it was published with. Lastly, we also make it possible to build standalone apps so people don't have to use the Expo client to open it, and you can distribute to the app store and play store if you like.
So Expo is a set of tools built on top of React Native. These tools depend on one key belief held at Expo: it's possible to build most apps without ever needing to write native code, provided that you have a comprehensive set of APIs exposed to JavaScript.
This is important because with React Native you can always drop down to native code. This is incredibly helpful sometimes but it comes at a cost: you need to send people your binaries if you want them to test them, someone on the other side of the world can't just tap a link to open it while you're working on it and you can't just publish it with one click for someone to access it similar to how you would in a browser.
With Expo, we suggest that try to avoid dropping down to native code, if you can. As I mentioned above, we think that with a comprehensive set of APIs available to JavaScript, this shouldn't be necessary for most apps. So, we aim to provide this comprehensive set of APIs, and then build all of the awesome tooling that can exist in a world where the native runtime is shared.
However, if you must find that you want to drop down to native, you can use eject and continue using the native APIs that Expo gives you while having the same level of control as you would in any native project.
A summary of the documentation and answers from Expo employees:
.apk
/ .ipa
file.apk
or .ipa
file.apk
and .ipa
files (distribution to stores possible with Expo)Sources:
The answer of Brent Vatne is fine but I'd like to add some details.
React Native does not give you all the JS APIs you need out of the box, but only most primitive features. React Native developers are expected to use Android Studio/XCode to link additional native libraries. Expo aims to enhance RN and provide all the JS API you need for the most common needs. It is basically a set of well-defined quality native libs already packaged for you in a single lib: ExpoKit. Sometimes these libraries are actually already existing in RN world, and integrated into ExpoKit.
It is also important to notice that the Expo team can't include every lib out there into ExpoKit (which may create some frustration) because the hello world app size would grow, as it would ship a lot of API's that wouldn't be used in most apps.
Like other systems (CodePush...), Expo provides a system to update your app over the air. This means you upload your JS bundle on a CDN and the mobile apps will automatically download and use the new JS on next startup (without requesting a publication/review from the stores).
Expo provides a CLI tool to upload/manage the JS bundles on their CDN. For development you can also choose to become the CDN and host the JS bundle on localhost. And XDE is just a visual wrapper on the CLI.
The Expo client is a generic client that permits to load any app that is compatible with Expo. All the Expo apps do share the exact same native runtime (RN + ExpoKit), the only difference is the JS that we give them. The Expo apps you publish to the app stores have your JS bundle url hardcoded in it. The Expo client is build in a specific way so that you can choose from which url to load the JS, by scanning a QRCode or providing an url.
Note that this client can also load JS bundles from localhost, and make your development experience easier: no need for XCode or Android Studio, and it gets much faster to get your first Hello World running on the phone (from hours to minutes). You can actually develop on an iPhone without a Mac and the setup takes 2 minutes.
Actually as the Expo SDK can be upgraded, the Expo client includes a compatibility layer so that it is able to run the last 5 SDK versions.
As all the Expo apps share the same native code, Expo is able to easily build these apps for you. They have created a cloud build service.
The major thing that differenciate 2 apps built by Expo is just the hardcoded url to which the app is supposed to download the JS bundle to run.
Expo does some other things for you, like providing a declarative way to setup app icons, orientations, permissions, api keys, helping you setup push notifications, provisioning profiles... many settings have to be hardcoded at build time in the app and can't be changed over the air.
React Native is similar Cordova. It is not the same view technology (native vs webview) but both allow you to control native features from javascript, and both offer a plugin system so that developers can easily add new JS/native bindings.
PhoneGap is similar to Expo. They both try to enrich the raw API of the underlying platform they are built on with a predefined set of additional native plugins. PhoneGap also offers a build service and has a generic client that work as long as you use the approved plugins.
As you can see, Expo is a set of tools. At the end it permits to easily develop, share and publish to the stores your mobile projects. It is quite similar to the PhoneGap experience (but a lot better and less confusing).
I will definitively recommend Expo for any new React Native greenfield project, except these 2 cases:
It is explained in the official Expo documentation
What is the difference between Expo and 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.
Pros:
Cons:
.apk
and .ipa
files is difficult.Pros:
.apk
and .ipa
files is much easier than with ExpoNote: React Native CLI is the framework to use to work directly with the React Native framework.
Cons:
As you can see, both approaches have their pros and cons; you should always decide which to use based on your needs for the project.
The answers about advantages and disadvantages of expo and react-native-cli are complete. I want to mention another point as my personal experience. Expo contains many modules by default in the project and it makes easier to work with it. But it has a big problem on production phase because the built android
and ios
versions have such a great size. For Example if you have a single page with a 'Hello World'
the apk
file size would be about 19 MB
. Having a same project in react-native-cli will result in an app with the size of 6 MB
.
So personally I do not recommend using expo if you want to develop a commercial app.
I would make a note here that Expo is using an older version of react 16.5 Which would prohibit you from using the new hooks feature. If you decide to go with Expo be mindful to watch your version controls. Older versions of say react-navigation will need to be used with the 16.5 version if you are getting weird errors.
I've experienced more than a year that works with expo If The Size of the app does not important for you use Expo because it's easy to implement Map, Push easier than React-native but at the end of the project if you want to publish app in Google Play or another store you have a challenge for remove some Permission in your APK React-native you can change everything but for importing some library such as push notification or the map needs some challenges too because you have to add these libraries manually to android and iOS projects
expo is a toolchain built around React Native to help you quickly start an app. It provides a set of tools that simplify the development and testing of React Native app and interface and services that are usually available in third-party native React Native components. With Expo you can find all of them in Expo SDK.