Common Dilemma of using expo vs Vanilla React Native being solved.

Muhammad Haris Baig
4 min readJun 14, 2019

--

If any one is planning to build a cross platform app and chooses react native framework, they usually get confused between using Vanilla react-native or using expo. I will try to keep things simpler for the readers so that they make choose one of the starter according to their requirements, so let’s get straight to the point and discuss expo first.

Expo is “a free and open source toolchain built around React Native to help you build native iOS and Android projects using JavaScript and React.” It provides a set of tools that simplify the development and testing of React Native app, besides that expo provides more robust and developer friendly development workflow at the cost of some flexibility. Expo apps ship with Expo SDK, which opens up numerous features to benefit yourself with like BarcodeScanner, MapView, ImagePicker, and so many more.

BUT…

→ You can’t add native modules written in Objective-C, Swift, Java, Kotlin.

→ You can’t use packages with native languages that require linking

→ The app has a big size as it is built with all Expo SDK solutions, even those you don’t use. An application with Hello World weighs 25 MB

→ Often everything works well in Expo client during testing, but certain problems may occur in a standalone app.

What if You are stuck in half?

when you are half way through building an app with Expo, and you came to now that your app’s requirements is not supported by an Expo development workflow, a developer can understand the pain but still you don’t have to go back and start bootstrapping the app from scratch you can still achieve that vanilla react-native functionality but that will not be exact what you want because if you have used some libraries or modules which are not available in react-native-cli for that you have to use expo kit. Luckily Expo has a method for turning an Expo project into a pure React Native app that is the eject command. When a project is ejected, all of the Native code is unpacked into ios and android folders, and the App.jsfile is split into App.js and index.js before eject command all the native code is hidden from the developer.

What to lose after eject?

Expo eases the burden of building binaries for the iTunes Store and Google Play store, keeps you from having to use Xcode and Android Studio, removes headaches from React Native upgrades in a project, and can manage your push notification pipeline but Unfortunately If you choose to eject from Expo, these are features you’ll lose all these features. All you will have to figure it out through logic and linking and pain processes.

Now have a look at react-native-cli

Initializing an app with the React Native CLI, via the react-native initcommand provides flexibility at the cost of ease of development. A React Native app created with the react-native init command is said to be a pure React Native app, since none of the native code is hidden away from the developer. All the ios and android folders are there withApp.js and index.js

The biggest advantage of React Native without Expo is that you can link the packages that use native modules and connect your native modules written in native languages. You also have an opportunity to and implement for example a background geolocation. You can add the package to compress images or videos and a lot of other packages that will improve your application.

Say good bye to versioning problems ; )

You can choose which React Native version to use, update to the newer versions, and get new opportunities. Besides, you can fork the code base and add your improvements exactly the way big companies do.

Final Verdict

It all depends on the requirements and functionality you want to implement in your app. If you are a beginner and you are trying to digest the behaviour, environment and workflows of react-native or any educational purpose is involved then Expo is the best choice for you. It will thrive you to go through these tough workflows easily. If this is not a big issue for you, and you want to give expo a try then go ahead Expo may be the right choice.

However, if your app requires a specific functionality and packages with native modules (written with native languages), it’s better to go with Vanilla React Native. As for me, the only drawback is that without Expo the project setup will take more time, but if you understand how the packages linking works and how to set up an app via Android Studio and XCode, you will easily develop React Native project without Expo.

--

--

Muhammad Haris Baig

Building Scalable Online Infrastructures with Cross-Platform Mobile Apps and Beautiful Websites.