Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Expo and React Native?

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?

like image 885
Aurora Avatar asked Aug 26 '16 16:08

Aurora


People also ask

Should you use Expo or React Native?

If you have a project requiring rapid development and have chosen React Native to build cross-platform applications, then Expo is for you.

What is Expo and React Native CLI?

If you are new to mobile development, the easiest way to get started is with Expo CLI. Expo is a set of tools built around React Native and, while it has many features, the most relevant feature for us right now is that it can get you writing a React Native app within minutes.

Can I use Expo API in React Native?

Note: this post was originally published on February 28, 2019, and subsequently updated on March 14, 2019 to reflect improvements to the workflow. Starting today, you can use as little or as much of the Expo SDK as you like in any React Native app.

When should you not use Expo?

Why Not Expo? The biggest perk of using Expo, is that you don't have to touch native code. But if you are a native mobile developer or have native mobile developers on your team that is working on building a React Native app, do not use Expo. Because, you won't be utilizing the native coding expertise while using Expo.


2 Answers

When you write code in Expo you are writing React Native code. Expo has two main pieces:

  1. Expo CLI (expo-cli): a developer tool for creating projects, viewing logs, opening on your device, publishing, etc.

  2. 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.

Read more about ejecting

like image 195
brentvatne Avatar answered Oct 12 '22 05:10

brentvatne


A summary of the documentation and answers from Expo employees:

React Native init:

Advantages

  • You can add native modules written in Java/Objective-C (probably the only but the strongest one)

Disadvantages

  • Needs Android Studio and XCode to run the projects
  • You can't develop for iOS without having a mac
  • Device has to be connected via USB to use it for testing
  • Fonts need to be imported manually in XCode
  • If you want to share the app you need to send the whole .apk / .ipa file
  • Does not provide JS APIs out of the box, e.g. Push-Notifications, Asset Manager, they need to be manually installed and linked with npm for example
  • Setting up a working project properly (including device configuration) is rather complicated and can take time

Expo

Advantages

  • Setting up a project is easy and can be done in minutes
  • You (and other people) can open the project while you're working on it
  • Sharing the app is easy (via QR-code or link), you don't have to send the whole .apk or .ipa file
  • No build necessary to run the app
  • Integrates some basic libraries in a standard project (Push Notifications, Asset Manager, etc.)
  • You can eject it to ExpoKit and integrate native code continuing using some of the Expo features, but not all of them
  • Expo can build .apk and .ipa files (distribution to stores possible with Expo)

Disadvantages

  • You can't add native modules (probably a gamechanger for some)
  • You can't use libraries that use native code in Objective-C/Java
  • The standard Hello World app is about 25MB big (because of the integrated libraries)
  • If you want to use: FaceDetector, ARKit, or Payments you need to eject it to ExpoKit
  • Ejecting it to ExpoKit has a trade-off of features of Expo, e.g. you cannot share via QR code
  • When ejecting to ExpoKit you are limited to the react-native version that is supported by ExpoKit then
  • Debugging in ExpoKit (with native modules) is a lot more complicated, since it mixes two languages and different libraries (no official Expo support anymore)

Sources:

  • code.tutsplus.com/tutorials/...
  • github.com/react-community/...
  • docs.expo.io/versions/latest/guides/detach
like image 36
Benjamin Heinke Avatar answered Oct 12 '22 03:10

Benjamin Heinke