EXPO! How Expo differs from React Native? Should I start my project with Expo? Many questions arise in newbies mind when he/she wants to get a start in the app development journey.
But, you are lucky as you have landed in the right place. I will try my best to explain everything in a simple manner.
As per official documentation of React Native, it is used to:
“Build native mobile apps using JavaScript and React”.Let me break it down for you React Native is a framework that helps us to build apps (both android & iOS) using a single javascript code base. It allows faster development as a developer only need to know javascript for developing both apps (iOS & android).
Learn Once, Write Everywhere
“Expo let you build native iOS and Android apps by writing JavaScript”.If you look into the definition of React native, both definitions look similar. Expo is doing what React-Native does. They both allow us to build native apps (iOS & Android) using javascript but there is a difference. You can think Expo is helping hand that helps us in faster development of React-Native applications. Expo apps are actually React-Native apps. The only difference is Expo comes with its SDK (Expo SDK) that provides us services like push notification, Facebook and Google login in just a few lines of code. It allows us to start our project in a minute. We don’t need Xcode (for iOS) & an Android studio (for Android) to get started. So, it’s easier to start. Now, you might wonder why the hell I would start my journey with React Native. I will use the Expo. But there is a quote by Brom
“Everything comes with a price”.Expo is good to start but it has some disadvantages. Let’s list down the advantages and disadvantages of an Expo. Advantages:
- Project setup is so easy and can be done in minutes.
- App sharing is easy (using the QR code and link). You can publish your app using ‘expo publish’ command and can share that link. No need to build .apk(for Android) and .ipa(for iOS).
- Expo can build both .apk and .ipa very easily.
- It provides services like Facebook, Google login, push notifications which you can easily integrate into your app without putting so much effort.
- The biggest disadvantage which I faced was apk or ipa size. Yes, basic ‘hello world’ app is about 20 to 25 MB big. The reason is integrated libraries.
- You can’t use native modules that is written in Java/Objective-C.
npm install -g expo-cliThis will install expo-cli in your machine. Before moving ahead, I would like to tell you about the two main parts of it : First part is an expo-cli. It is a tool that helps us in our development process like in setup of our project, in building APK or IPA, etc. The second part is Expo client app which we have to install on our Android or iOS phone to scan the QR code (which you can get using ‘expo start’ command) that will open a project in our Android or iOS phone. Confused! If you don’t get it. It’s fine, I am going to explain it step by step. After installing expo-cli, let’s create your project using:
expo init myAppIt will ask about choosing a template. Go with blank by pressing enter. You can also explore the second one with examples as well. Right now, go with blank and then follow below two commands to run your project.
cd myApp expo startThis will generate QR code.
Generated QR code
Bundling of project is taking place. App will run on your device after completion of bundling process.
Click on the notification, it will start bundling process.