Thinking about using Expo for your next React-Native project?

Introduction

Expo is a free and open source framework for building React Native projects with JavaScript and React. It includes several build-in components, which developers commonly need to manually integrate, for almost any project, like support for push notifications. These integrated components and simplified build, allow developers to bring-up new React-Native applications quicker. If the app could be made with with JavaScript-only components or the native components already bundled with Expo, programmers never have to deal with native code and are able to rely on Expo for everything. Expo conceals the native parts of React Native applications, unless and until the point developers “eject” the application. Until an Expo application has been ejected, there is no way to add native modules, expect for those already bundled with Expo. Upon ejection, Expo framework will generate machine-dependant native parts of the application and allow inclusion of custom components. At the heart of interoperability of ejected Expo applications with React-Native is the ExpoKit library.

Why use Expo?

One of the major hurdles while building React-Native applications is having the full set of correct configurations inside iOS and Android project files. Since it is possible to build React-Native applications both from command-line and IDE tools, as well as to perform both full and partial builds, a lot of times developers are able to compile the project by using some means, and not others. For example Xcode build might work fine, while CLI build with react-native run-ios could fail. When developers do not setup their React Native application CI pipeline at the beginning of the project, they often get stuck for days working with Xcode project files, cocoapods and gradle to make the React-Native project build with continuous integration tools.
The Expo workflow alleviates this problem altogether. Developers work on apps using expo-cli and the client app, publish new code and assets using expo publish, and build new versions of the binaries on the build services using expo build:[ios/android]. Expo deals with the native components, while programmers just write JavaScript/React code. Expo refers to this as the “managed” workflow.
Some of the components, which Expo includes:

  • Push Notifications
  • Facebook Login
  • Over-the-air updates

Further, since Expo deals with native parts of React-Native applications, developers are able to build apps that run on iOS using PC/Linux, whereas otherwise programmers are being forced to use Macs. Expo also helps with management of certificates and app signatures.

Why not use Expo?

ExpoKit is currently a second-class citizen, even though this is slowly changing. This makes maintaining ejected/unmanaged projects difficult. At the same time, building production apps without custom native modules is often impossible. Expo does not include such commonly used component as In-App Purchases. Expo artifacts are also larger than regular React Native binaries, since it includes support for all the functionality that Expo could utilize versus only the pieces included in the app. The same applies to the application permissions. If you want to fully control what goes into the binary, Expo won’t work. Since Expo builds the application binaries for developers, it limits the control developers can exercise over their codebase. In essence, using Expo to do builds is similar to using a cloud-based build service, which is totally fine for many projects. However, if your security dictates using a private build infrastructure, managed Expo workflow won’t work.
Since almost all Expo projects end-up being ejected sooner or later, until ExpoKit workflow is properly supported, Expo is best used after an extensive features review.

Conclusion

Expo is a great tool for quick prototyping. Whether it will be suitable for your production application, greatly depends on the features that you need. Once/if ExpoKit gets sufficiently improved, Expo might be suitable a lot more React-Native projects.
If you are looking for some of features that come with Expo, for your classic React Native apps, consider using Visual Studio AppCenter. It has error reporting, push notifications (even background ones) and Over-The-Air (OTA) updates, as well as other goodies like integration with Azure Pipelines.
We also recommend that if you went the classic React Native route, using react-native init to setup your CI pipeline for both Android and iOS, right away.

More from our blog

See all posts