Expo vs React Native CLI

Academind by Maximilian Schwarzmüller
A free video tutorial from Academind by Maximilian Schwarzmüller
Online Education
4.6 instructor rating • 25 courses • 1,332,455 students

Lecture description

We know that components are compiled to native code, but what happens to the JavaScript portion of our app? This lecture explains how React Native handles that.

Learn more from the full course

React Native - The Practical Guide [2021 Edition]

Use React Native and your React knowledge to build native iOS and Android Apps - incl. Push Notifications, Hooks, Redux

32:29:01 of on-demand video • Updated December 2020

  • Build native mobile apps with JavaScript and React
  • Dive deeper into React Native
  • Develop cross-platform (iOS and Android) mobile apps without knowing Swift, ObjectiveC or Java/ Android
English So now that we have an idea of what React Native is, we can get started with React Native and I'd say let's get started by building our first little React Native app or by getting our first React Native app up and running. So we want to create a new React Native app and as it turns out, we actually got two options for that. If you search for React Native, you'll find the official page and on that official page if you click, on get started, you actually have two options here. You have the Expo CLI quick start and the React Native CLI quick start. Now what's the difference and which approach should you use and why and what will we use in this course? So we can use the Expo CLI, the expo tool for generating and managing our React Native app or we use the React Native CLI. Now if you first have that choice, you would probably go for the React Native CLI because you want to build a React Native app after all, right? Well let's have a look at what expo is. It's a third-party service which is completely free to use, you don't need to sign up to get started and you don't have to pay to build an app which you can publish to the App Store, so it's really free to use. What expo gives you is kind of a managed app development workflow. It takes a lot of the complexity away from you because building React Native apps can be very complex, especially when it comes to integrating certain native device features like accessing the camera and expo simply gives you a lot of convenience there, it makes development of React Native apps a breeze and so much easier. The downside is that you're limited to the expo ecosystem because expo in the end is like a wrapper you could say around your app, a thin extra layer between your app and the native raw React Native experience and you still get a native app in the end and you still use React Native under the hood, that's all happening but expo abstracts away some of the complexity, which also means it of course removes some of the finegrained control you would normally have if you build a raw React Native app because if we have a look at that other workflow, the React Native CLI, that's in the end managed by the React Native team or parts of the React Native community and there you have a barebone development setup, which means you get a native app, you need to install Android Studio, you need to install Xcode to build that app and you need to configure and manage a lot on your own. As soon as you start adding certain native device features, like let's say as soon as you want to use the device camera, you will have to bring in third-party packages where the set up process can be quite complex and therefore, this can be more cumbersome. You have pretty much no convenience or utility features to tap into but of course, the advantage would be that you have full control, you can control every tiny piece, you can easily write your own native Android and iOS code and connect this to your Javascript code, that's not really possible with expo. So if you are a super advanced developer and you already know you'll be building a very complex app where you need to do a lot of manual workarounds, a lot of finegrained configuration, then you definitely want the full bare bones experience on the right. If you are getting started or if you're building a normal app, then the Expo CLI will very likely give you everything you need, it gives you wrappers for the most common native device features you need, like using the camera, like using maps, that's all made super simple and if you ever get to a point where you find out oh I need more control, then you can always also switch from the expo workflow to the native workflow, you can eject and then you have the full flexibility. Therefore, nothing speaks against getting started with expo, you can always switch to the other experience if you need to and we'll use expo in this course because it's simpler, because it gives you everything you need for most apps, because it's so much more convenient to work with it and because you can always switch. Now later down in the course, I will also give you an introduction to the more bareboned workflow and what that would mean for you but for the majority of the course, we'll work with expo. Behind the scenes, this expo tool work such that you have your native device or your simulator, so your iPhone or your Android phone and you have your app, your React Native app you'll be writing, so your Javascript code where you write your React Native app. Now on your native device or on the simulator, you will install extra app from the App Store, the expo client app and we'll do that together in the next lecture. Now your app can then be loaded into the client app which is this extra wrapper to see it there, to run it there, to test it there and that's of course great for development. You can also publish your app as expo app so that other people who have the expo client installed can easily run your app, they don't even need to install it from the Google Play Store or the Apple App Store but of course typically you want to build an app which you can publish to these app stores and no worries, that's possible with expo too. That extra client app which you have, which wraps your app, is great for development because it speeds up the entire development workflow but if you want a standalone app, so an app that is not relying on the expo client, which most of your potential users probably won't have installed, well then expo also allows you to build and publish standalone apps, so apps that do not rely on the expo client being installed. So therefore with expo, you can build normally apps which are distributed to the normal app stores standalone where your users don't need any special app installed but you have that extra convenience during development which is great and as I mentioned before, if you would need to, you can always switch or eject as it's called to the non-expo development flow as well.