Skip to main content

New project

Package managers

I'll be using node@20 and yarn@1.22.22.

All modern package managers are supported: npm, yarn classic, yarn modern, pnpm and bun. Small differences in configuration may exist. Check the documentation for details if using a different package manager than the instructor.

Set up a new React Native project

The command to create a new React Native project with Expo is npx create-expo-app.

In your terminal, run:

npx create-expo-app --help

to check what options you can pass in. Two things to note here:

  • the --template flag lets us choose a specific template instead of using the default one
  • you can run this command with different package manager if you won't want to use npm

In your terminal run (one of) the following:

## if using yarn
yarn create expo-app plantly -t

## if using npm
npm create expo-app -- plantly --template
## or
npx create-expo-app plantly --template

## if using pnpm
pnpm create expo-app plantly -t

## if using bun
bun create expo-app plantly --template

... to create a new project called taskly. When prompted, choose the blank TypeScript template.

Do I have to use TypeScript?

I'd very much recommend it. Most modern software projects use TypeScript and it's become the industry standard for JavaScript projects.

But if you really don't want to, choose the blank JavaScript template instead. I will be using TypeScript throughout the course, but you can still follow along and simply omit any type info.

I also created a JavaScript-only version of the app we're going to be building if you want to double check your work.

Run the app your phone

Download the Expo Go app from the Google Play or Apple App Store.

In your terminal, go to the newly created taskly project and run:

npx expo start

... to start the JavaScript bundler.

On Android: open the Expo Go app and scan the QR code printed in your terminal to connect the bundler.

On iOS: open the camera app to scan the QR code. It will deep link to Expo Go.

You should see a blank screen with a welcome message.

Checkpoint

AndroidiOS
Checkpoint
If you are unable to connect to Expo Go

If you find that you are unable to load the JavaScript bundle in Expo Go, check that your phone and computer are on the same wifi network. The metro bundler is running on localhost on your local machine, which is why your device needs to be on the same network to access it.

If you are still unable to connect, it could be due to firewall or privacy settings on your computer (this is not uncommon, especially for Windows users). Try running the start command with --tunnel, like yarn start --tunnel. This will prompt you to install ngrok if not yet installed, an tunnel your JS bundle to an external API. This is slower than the default approach, but will allow you to load the app from a different network or get past the firewall or same-network restrictions.