Expo CLI vs React Native CLI

Ponraj Thuvarakan
4 min readApr 23, 2022

--

The main two tools for developing react native apps there are Expo CLI & React Native CLI. CLI defined as command line interface.

CLI

A command-line interface (CLI) is a text-based interface that allows you to write commands in the form of lines of text that are subsequently processed by the computer. Examples for cli Microsoft Windows, DOS Shell, and Mouse Systems PowerPanel.

Expo CLI

Expo CLI is a command-line application that serves as the primary interface between a developer and the Expo tools. You’ll utilize it to do things like:
create new project, Developing your app: running the project server, viewing logs, opening your app in a emulator, publishing your app, viewing logs, opening on your device etc.

Expo allows us to build for both Android and iOS on Windows, Mac and Linux. You can run your React Native app on a physical device without setting up the development environment. All you need to do is download the Expo Go app, run expo start and then scan the QR code that shows up.

playstore link:- https://play.google.com/store/apps/details?id=host.exp.exponent&hl=en&gl=US

appstore link:- https://apps.apple.com/us/app/expo-go/id982107779

any way Expo is the most easy way to get started with React Native. However, you can’t develop custom native modules with Expo other than the ones that come with the React Native API. It is preferable to start with vanilla React Native if you wish to include native code in your project.

To get started with Expo, you must first install the Expo CLI. You can accomplish this by issuing the following commands

install expo CLI

npm install -g expo-cli

check Expo CLI version

expo --version

Expo requirements

Node.js LTS release, Git & Watchman for macOS or Linux users

Recommended Tools

VSCode Editor, VSCode Expo Extension for app.json debugging and autocomplete, Yarn
Windows users: PowerShell, Bash via WSL, or the VSCode terminal.

didn’t need to android studio & Xcode for Expo CLI

React Native CLI

The React Native CLI is a built-in functionality that allows you to manage the project locally. You have the ability to design and run programs. Using this command, you can easily create a project.

The benefit of React-Native CLI is that it allows you to implement any third-party plugins you want while also allowing you to tweak any implementation. You are not confined to any version of React-Native or any minimum OS version handling, and you are free to produce builds at any moment without the necessity for an Expo server subscription.

Installation process

we need to Node, java SE development kit (JDK), and also check the version of node is 14 or newer & JDK version 11 or Newer In your system.

we must need to android studio & install the android SDK then set the environmental variables

install react native CLI

npm install –g react-native-cli

create new project as “NewProject”

npx react-native init NewProject

To run your React Native Android app, you’ll need an Android device. This can be a physical Android device or, more often, an Android Virtual Device that allows you to imitate an Android device on your computer.

If you have a real Android device, you can utilize it in place of an AVD for development by connecting it to your computer through a USB wire. or otherwise you go to virtual device & By launching the “AVD Manager” from within Android Studio, you may see a list of available Android Virtual Devices (AVDs). if you use open in android studio you

./AwesomeProject/android

Run your React native application use this command

npx react-native run-android

If everything is set up correctly, your new app should be operating in your Android emulator like this

React Native CLI requirements

in MacOs
Node, Watchman, Xcode and CocoaPods.

in Windows/linux
Node,JDK and Android Studio.

if you have macos both android and ios platform are supported .
if you have windows or linux you only develop android platform.

Pros and Cons in Expo CLI

pros

  • install and using a project is simple and takes only a few minutes.
  • It’s simple to share the app (by QR-code or link)didn’t need to send entire .apk or .ipa file.
  • its extremely fast to deploy a project from coding, to building, to publishing its usually really fast.
  • There are many libraries built and curated by Expo, and if there aren’t any, there is always an alternative library that works with Expo, as most developers now code libraries with Expo in mind.
  • Easier to upgrade to new versions
  • No build necessary to run the app
  • You can eject it to ExpoKit and integrate native code continuing using some of the Expo features, but not all of them

Cons

  • Native modules cannot be added.
  • The only supported third-party push notification service is the Expo notification service
  • The basic hello world app size is 15–20MB
  • Debugging in ExpoKit (with native modules) is a lot more complicated, since it mixes two languages and different libraries
  • If you want to use: FaceDetector, ARKit o Payments you need to eject it to ExpoKit
  • Not all iOS and Android APIs are available

Pros and Cons in React Native CLI

pros

  • You can include native modules coded in Java/Objective-C.
  • Reusable code & pre-built components.
  • You will be having control over the builds.

cons

  • Needs Android Studio and XCode to run the projects
  • If you want to send your app to somebody you need to send the whole .apk .ipa file.
  • You can’t build an app for iOS without having a Mac
  • Setting up a working project properly is difficult and time-consuming.
  • To utilize the device for testing, it must be linked through USB.
  • To run the projects, Android Studio and XCode are required.
  • Fonts need to be imported manually in XCode

--

--

No responses yet