🐣 Getting Started

Let's get started with our first react native app!

Installing dependencies

Since we'll be using Expo Tool to create react native applications, we'll need to install the Expo CLI tool, which depends on NodeJS as well. If you do not have NodeJS installed, it is recommended that you install the package from their official website or using your system's package manager.

Once we have NodeJS installed, we can continue with installing the Expo CLI tool. To install the Expo CLI tool, run the following command:

sudo npm install -g expo-cli

Ignore any warnings that you might encounter during the installation. In case the installation fails, try the below command:

sudo npm install -g expo-cli --legacy-peer-deps

This will install the Expo CLI tool with legacy peer dependencies.

Creating an Expo App

Once we have NodeJS and Expo CLI tool installed, we can now proceed to create a new application. It's as simple as using the CRA command for web development!

mkdir <app-repo> && cd <app-repo>
expo init <app-name>

The above command will create a new Expo app within the app-repo directory. It will also prompt us to select a template to start with, so here we will start with the blank template.

When the above command is done executing, we can then cd into the app directory, and run the following command to initialize the app:

yarn start

This will run the expo script to run the application in development mode. This will open up a webpage at http://localhost:19002/ and also show us a QR Code that we can then scan and use the application on our native devices. The QR code is also displayed on the terminal as well!

http://localhost:19002/
QR Code for the app in the terminal.

In order to run this Expo app on our native devices, we first need to install the Expo Client (now renamed to Expo Go) app on our native devices. Once this app is installed, use the inbuilt camera to scan the QR code displayed on the webpage/terminal, which will redirect you to the Expo Go app, where we can see our app running! Below is a screenshot of the same:

First App running on Expo Go (iOS).

For Android devices, we can simply scan the QR code from within the Expo Go app, which will spin up our first-app.

Last updated

Was this helpful?