Expo v/s React Native CLI. What to choose and what to stay away from.

Divyaswor Makai
Nerd For Tech
Published in
6 min readJun 30, 2021

--

React Native CLI v/s Expo

This post is entirely based upon my personal experience with React Native and Expo. I have been using React Native for hybrid mobile application development for over a year as of now and at the same time got exposed to Expo framework as well. During this time I had to juggle between the two platforms for several projects. I admit that most of the switch to Expo was due to the fact that I have no personal Mac environment to build and test iOS applications. :)

Let us start by introducing ourselves with the platforms. React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces. Whereas Expo is basically a tool built on top of React Native. Some of you readers familiar with both might say both are the same. Only difference is how you build them. I agree with you. Both use code structure of React Native, but there are major differences as well. I will just be listing the major differences from here on out.

Addition of Native Modules:

Native Modules might be anything that will be written in Java for Android and Swift for iOS. React Native is ultimately converted to Java code by the JavaScript bridging. You can read a little more about this here. Native modules always will be faster than JS code and it is true at the time of writing this for React Native. If you want to write you own native module and integrate it with your React Native application then you can do it easily with React Native CLI but if you are using expo then you will have a hard time doing so. Of course you can eject the expo project. But using this way you have to totally depend on expo for the ejection which can cause problems at times. Like when Expo SDK upgraded from 38 to 39, most of the developers faced problems when they couldn’t even run the application.

Ejecting Expo project builds a bare React Native project for which if you add a Native module and want to build again, you will need a Mac system for iOS. So if you eject an expo application you will end up with React Native CLI project. So the point here goes to React Native CLI.

Building Projects:

When building with Expo, you have to register into the expo. That way you can build an apk/aab for android and similar package for iOS. Everything happens in their cloud. The source code is taken from your folder and uploaded into their platform. The build happens there and they give you a final bundle, which you can download. You can even view the status of the projects being built there.

Expo build queue

You don’t have to worry much about the build procedure as Expo handles it themselves. In React Native CLI, the building process happens entirely on your system. As I mentioned earlier I have only built android applications as I have only windows system and you must have a MacOS for building the iOS build. One of the projects I made in React Native CLI is here. So you will have to face build errors such as Gradle failure, manifest errors and so on. This is not a bad thing cause you will get to learn but also means that you need a little bit of knowledge with Java/Kotlin and xml files as well as the native android building platform like Android Studio. The point thus goes to Expo because of its simplicity.

However, Expo might be simple but it generally builds apk as big as 55MB, which is a rather huge file for mobile applications. I tried two builds Expo and both were above 50MB. Whereas I had several builds with React Native CLI and the most I got was 30MB. And trust me the project in CLI was much bigger than that of Expo. Besides this, building in Expo requires you to wait for your turn in queue and there are times when you’re very late to the queue and the build might take upto 3 4 hours to complete. So the point goes to React Native CLI.

Knowledge/Skill Requirement:

Talking about the technical skills required for both platforms, developers must have good knowledge about React Native, ReactJS and plain JavaScript to perform their duties. If someone doesn’t have this much of knowledge then they won’t be able to do much. The exact thing applies with Expo, with the knowledge in fields listed above, people can easily design, develop their applications with Expo. However, it is not enough for React Native CLI developers. They should have little experience with Java since the project will be bridging with Java code in the end. You can even see it in the packages you use in React Native CLI. They give out clear instructions on where to add code in the Java file in case of adding packages manually. (There are cases when npm doesn’t install the packages properly.) For example, we can see a package, react-native-svg. There are clear instructions on how to add the packages manually in the documentation of the package. Whereas in expo, you can easily install the packages with the “expo install package-name” command and you won’t have to worry as long as the package you’re trying to install is supported by Expo itself.

Manual package linking in Android
Manual package linking for iOS

Having knowledge about something doesn’t hurt so I give the point to React Native CLI on this one.

Application Sharing/Testing:

Let us consider an example where you want to share your application to your friends or fellow developers so that they can run the application in their devices and you can receive valuable feedbacks from the. For React Native CLI, you would have to build the apk (which is again handling the build errors and all the stuff), share the apk to your friends and take feedback from them . Expo on the other hand easily helps with you on this. I have written an entire application for this and you can read it here.

Basically with Expo you can tunnel your application and let your friend scan the QR code generated by expo or send an email for downloading the application and let them test the application. Another great thing about it is that they can do it for Android, iOS or even for the web. Expo gives it all. So the point goes to Expo on this one.

So if you counted the points, based on the things mentioned above, we have 3 points for React Native CLI and 2 points for Expo. That doesn’t mean Expo is inferior to CLI. However it does point out that depending entirely on a tool that is built on top of another framework should be considered wisely before random development. There are various cases when people had to eject Expo applications due to several reasons just to let go of the expo dependencies. But for learning and development, Expo is a boon for developers and frankly has been a boon for me as well.

Conclusion:

I wouldn’t say one is superior to the other and believe learning and having experience with both the platforms is advantageous but I prefer to use CLI more if you have the system for iOS build cause that way you will have a chance to deal more with android native modules. Whereas if you are just starting off, then you can opt for Expo cause it’s easy to learn and use.

Thank you for reading.

--

--

Divyaswor Makai
Nerd For Tech

Full Stack Web Developer, Game Developer, ReactJS, VueJs, NodeJS, ExpressJS, Unity, React Native.