Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Expo CLI and React Native CLI? [duplicate]

React Native provides two way to create Project.

First:

npm install -g expo-cli 

Second:

npm install -g react-native-cli 

so what is different between them and what should be used if we create react native app?

like image 841
Jitendra Suthar Avatar asked Feb 25 '19 08:02

Jitendra Suthar


People also ask

What is difference between React Native and Expo?

Expo is a framework to build React Native apps. It is a set with tools and services built for React Native. It will help you begin with building React Native apps with ease. It provides you with a list of tools that simplify the creation and testing of React Native app.

Is Expo faster than React Native CLI?

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.

Can we use Expo CLI in React Native CLI?

If you create a bare React Native project through expo-cli by running expo init and choosing a Bare template, your project will have react-native-unimodules installed and configured for you. You can run this project by using react-native run-ios or react-native run-android rather than expo start .

What is Expo CLI in React Native?

Expo Go allows you to run your React Native app on a physical device without installing iOS and Android native SDKs.


1 Answers

React Native init:

Advantages:

  • You can add native modules written in Java/Objective-C (probably the strongest feature)
  • You will be having control over the builds.

Disadvantages:

  • Needs Android Studio and XCode to run the projects
  • You can't develop for iOS without having a mac
  • Device has to be connected via USB to use it for testing
  • Fonts need to be imported manually in XCode
  • If you want to share the app you need to send the whole .apk / .ipa file
  • Does not provide JS APIs out of the box, e.g. Push-Notifications, Asset Manager, they need to be manually installed and linked with npm for example
  • Setting up a working project properly (inlcuding device configuration) is rather complicated and can take time

Expo:

Advantages:

  • Setting up a project is easy and can be done in minutes
  • You (and other people) can open the project while you're working on it
  • Sharing the app is easy (via QR-code or link), you don't have to send the whole .apk or .ipa file
  • No build necessary to run the app
  • Integrates some basic libraries in a standard project (Push Notifications, Asset Manager,...)
  • You can eject it to ExpoKit and integrate native code continuing using some of the Expo features, but not all of them
  • Expo can build .apk and .ipa files (distribution to stores possible with Expo)

Disadvantages:

  • You can't add native modules (probably a gamechanger for some)
  • You can't use libraries that use native code in Objective-C/Java
  • The standard Hello World app is about 25MB big (because of the integrated libraries)
  • If you want to use: FaceDetector, ARKit o Payments you need to eject it to ExpoKit
  • Ejecting it to ExpoKit has a trade-off of features of Expo, e.g. you cannot share via QR code
  • When ejecting to ExpoKit you are limited to the react native version that is supported by ExpoKit at that point in time
  • Debugging in ExpoKit (with native modules) is a lot more complicated, since it mixes two languages and different libraries (no official Expo support anymore)

And you can use any one which satisfies your applications requirement

like image 66
Syed Avatar answered Sep 22 '22 03:09

Syed