Building React Native Apps — Expo or not?

Are you thinking of using React Native to build cross-platform apps? When you set out on a path to build apps using React Native, you come across the question, should I use Expo or not?

React Native Background

Before we talk about Expo, here is a quick background on React Native.

I have been developing React Native apps for the last four years and I must say that things have evolved drastically in React Native, and Expo has a big role towards its success as well.

React Native is a cross-platform library that builds native mobile apps (iOS and Android) using JavaScript and React. The reason owing to its success is the fact that it uses the popular language JavaScript, in combination with the most sort after web library React to build mobile apps natively.

What is Expo?

Expo is a framework that is used to build React Native apps. It is basically a bundle with tools and services built for React Native, that will help you get started with building React Native apps with ease.

So there are two ways to build React Native apps. One using expo, and the other just using plain React Native, without Expo.

When and Why Should I Use Expo?

When you start building React Native apps, you have to make this decision early on. You have to decide whether you will be utilizing Expo for your project or not. This is because the architecture for your entire project relies on this decision.

Here are some good reasons to use Expo to build your React Native app.

1. Fastest way to build React Native Apps

If you are given a project that needs rapid development, and you have picked React Native to build the cross-platform app, Expo is the best fit for you. With Expo, you can build and deploy React Native apps for both iOS and Android with ease.

2. You don’t need to know Native Mobile coding

With Expo, you will never touch any native iOS or native Android code. This means, you don’t need developers to know any native mobile coding while building apps using Expo. Expo handles all the native code under the hood, and this is not available to the developers who are using it.

Whereas, if you build React Native apps from scratch without Expo, based on what I have seen you will need to use a tiny bit of your native mobile coding skills. Although 95% of the code is shared between iOS and Android, depending on your use-case, you still may have to tweak some native code on both platforms. For anyone who wants to avoid getting into that layer, Expo is the best fit.

3. No Xcode, No Android Studio

If you don’t need to do any native mobile coding using Swift (iOS) or Java (Android), it means you don’t have to ever use tools like Xcode or Android Studio. My least favorite part of being a React Native developer is to deal with all the problems I face while I use both Xcode and Android Studio.

With Expo, there is no need to ever worry about these tools, since you would never need them.

4. Publish Over The Air (OTA) Updates Instantly

A really nice feature that you can utilize while using Expo is Over The Air (OTA) updates. Since all of the code you write to build your app using Expo, is in JavaScript, you can push updates to your app anytime over the air. You would not need app store approvals to do so. The biggest pain point in mobile app development, is going through the app stores to publish updates to your apps.

With Expo, you can quickly publish updates to your app over the app, with ease. There is no native code, hence you don’t need to go to the app store to publish every single update. This is a great feature that comes in handy for rapid development and testing cycles.

5. In-built access to Native APIs

Expo comes with a lot of native APIs out of the box for both iOS and Android. This makes the developers job of adding native features to the app fairly easy. Some of the common native features provided by Expo are, Camera, file system, location, social authentication, push notifications, to name a few. While using Expo, you don’t need to worry about integrating these native features, since they are available to you as a part of the Expo bundle.

The entire list of available APIs with the Expo SDK is linked below:

Expo APIs

6. It is FREE and Open Source

Last but not the least, Expo is free and also open-source. The Expo community is welcoming and growing. You can contribute to it as well since it is open-source. You can access the Expo repo from the link below:

Why Not Expo?

Well, there are so many reasons why you should choose to use Expo to build your React Native app. But there is always a choice to say no as well. There could be some situations when Expo may not be the right fit for you either. Let me list some of the caveats of using Expo below:

1. If you are a native mobile developer, or have native developers on the team

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. This could be frustrating for a developer with native background.

Instead, build React Native apps without Expo. You can build apps using the plain React Native CLI. With this you can always tweak or customize some native components and APIs as needed.

2. Adds another layer of abstraction — Too much magic

Some developers don’t like that Expo adds another layer of abstraction to the already abstracted layer. React Native itself has a layer of abstraction and it is essentially a wrapper around the native iOS and Android components. Now adding another layer of abstraction with Expo, is not something some developers maybe comfortable with. This means, there is a lot of stuff happening under the hood, that we don’t have control over. In my perspective, this is not a real problem. If the ultimate goal is to build a solid React Native app, the magic is actually a good thing. But this is totally subjective.

3. Not all iOS and Android APIs are available yet

The official Expo documentation states that not all iOS and Android APIs are available yet. Features like bluetooth, In-App purchases are not available with Expo yet. Make sure to read to verify all the features you are trying to build are available with Expo, before you decide one way or other.

4. Can’t pick your choice of Push Notification service

With Expo, you don’t get to pick the push notification service like Firebase. You have to go with what comes out of the box, which is One Signal. If this is something that could be a problem to you, then Expo is not for you.

You can always Eject from Expo

Let’s say you did decide to build your React Native app with Expo, but few months later want to opt out. You can always eject your app from the Expo ecosystem. But it may come with a cost:

  • You may have to rewrite your push notification code
  • Refactor code to use other libraries that are not a part of Expo ecosystem
  • Navigation changes and general code refactoring

Conclusion

It is an interesting time in mobile development. To use Expo or not for your React Native apps depends on the features, timelines, preference and developers who are working on it.

You can checkout my course on React Native below to get started with React Native:

React Native : The Big Picture

Other Resources:

https://expo.io/developer-services

https://facebook.github.io/react-native/blog/

I hope you enjoyed this article. See you again with more articles. If you liked this post, don’t forget to share it with your network. You can follow me on twitter @AdhithiRavi for more updates or if you have any questions.

This article was originally posted at https://programmingwithmosh.com/

Software Consultant, Author, Speaker, React Native|React|GraphQL Dev & Indian Classical Musician http://adhithiravichandran.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store