Start an app with Expo (React Native)
Create an Expo app, run it on your own phone with Expo Go, and build a first screen with View, Text and Pressable. Learn how React Native differs from HTML and CSS on the web.
In this tutorial you will create a new Expo app, run it on your own phone, and change it to be a small Brew & Bean welcome screen with a tap counter. You will learn what the files in the project do and how React Native components differ from HTML.
Prerequisites: Node.js (LTS version) installed, a code editor such as VS Code, basic JavaScript, and ideally some React (components, props, useState). You need an Android phone or iPhone on the same Wi-Fi network as your computer. No Android Studio is needed.
What you need
- 1Check Node is installed: run
node --versionin a terminal. If the command is not found, install the LTS version from nodejs.org. - 2On your phone, install Expo Go from the Play Store (Android) or the App Store (iPhone). Expo Go is a ready-made app that loads your project over Wi-Fi, so you can test without building anything.
- 3Connect the phone and the computer to the same Wi-Fi network. College and office networks sometimes block this; a phone hotspot shared to your laptop works as a fallback.
Step 1: Create the project
npx create-expo-app@latest brew-bean
cd brew-beancreate-expo-app downloads a starter project and installs its packages. The first run can take a few minutes on a slow network.
The default starter uses TypeScript and Expo Router, and includes example screens. To keep things simple we will start from a clean slate. The starter has a script for this.
npm run reset-projectThis script moves the example code into a folder called app-example and leaves a minimal app folder. If it asks whether to move or delete the example files, either answer is fine; moving is safer.
Step 2: Run it on your phone
npx expo startStarts the development server (called Metro) and prints a QR code.
- 1On Android, open Expo Go and choose Scan QR code. On iPhone, scan the QR code with the normal Camera app.
- 2Wait for the bundle to load. You should see a white screen with the text "Edit app/index.tsx to edit this screen."
- 3Leave the terminal running. It is your development server.
Edit app/index.tsx to edit this screen.Phone will not connect?
If the phone cannot connect, the usual causes are different Wi-Fi networks, a firewall on the laptop, or a network that blocks device-to-device traffic. Try npx expo start --tunnel (Expo will offer to install a helper package). It is slower but works across networks.
Step 3: Know your project
The files that matter
| File or folder | What it is for |
|---|---|
| app/ | Your screens. Each file here becomes a screen (this is Expo Router, covered in a later lesson) |
| app/_layout | The root layout that wraps every screen |
| app/index | The first screen (the home route, /) |
| app.json | App settings: name, icon, splash screen, package ids |
| package.json | Dependencies and scripts such as npm start |
| assets/ | Images and fonts |
| node_modules/ | Installed packages. Never edit or commit this |
The starter's screens are .tsx files (TypeScript). In these lessons we write plain JavaScript, which Expo supports in the same project. So delete app/index.tsx and create app/index.js. If you prefer TypeScript, the code works in .tsx once you add types for props.
Step 4: Write your first screen
In React Native there is no div, p or button. You use built-in components: View is a box (like div), Text shows text (all text must be inside it) and Pressable handles taps. Styles are JavaScript objects made with StyleSheet.create, not CSS files.
import { useState } from "react";
import { View, Text, Pressable, StyleSheet } from "react-native";
export default function Home() {
const [cups, setCups] = useState(0);
return (
<View style={styles.container}>
<Text style={styles.title}>Brew & Bean</Text>
<Text style={styles.subtitle}>Indiranagar, Bengaluru. Open 8 am to 10 pm.</Text>
<Pressable style={styles.button} onPress={() => setCups(cups + 1)}>
<Text style={styles.buttonText}>Add a coffee</Text>
</Pressable>
<Text style={styles.count}>Cups in your order: {cups}</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
padding: 24,
backgroundColor: "#fff8f0",
},
title: { fontSize: 32, fontWeight: "bold", color: "#4a2c17" },
subtitle: { fontSize: 16, color: "#6b4f3a", marginTop: 4, marginBottom: 32 },
button: {
backgroundColor: "#4a2c17",
paddingVertical: 14,
paddingHorizontal: 28,
borderRadius: 10,
},
buttonText: { color: "white", fontSize: 18 },
count: { fontSize: 18, marginTop: 24 },
});Save the file. The app on your phone reloads by itself (Fast Refresh) and keeps its state where possible.
A cream-coloured screen. The title "Brew & Bean" and the address are in the middle, with a brown "Add a coffee" button. Each tap increases the number in "Cups in your order".Compare with React for the web. The useState hook and JSX work the same. What changes: onPress instead of onClick, no CSS files, no HTML tags, and layout uses flexbox with a column direction by default (on the web the default is row).
Step 5: See errors and the developer menu
- 1Break something on purpose: change
<Text>in the title to<Txt>and save. A red error screen appears on the phone with the message and the line. Fix it and the app recovers. - 2In the terminal running Expo, press
rto reload the app,mto toggle the developer menu, andato open it on an Android emulator if you have one. - 3On the phone, shake the device to open the developer menu.
Read the red error screen from the top. The first line is usually the real cause. Copy it into a search or into an AI assistant along with the file contents.
I am learning React Native with Expo. Explain this error in simple English, tell me which line is probably wrong and show the fix.
Error message:
[paste the red-screen message]
My file:
[paste the file]What to expect: A good answer names the cause (for example text outside a Text component, or a misspelled component), points to the line and shows corrected code. Check it against the Expo or React Native docs before relying on it.
Expo Go and development builds
Expo Go is perfect for learning. It already contains many common libraries (camera, location, storage). Its limit is that it only contains the code that Expo chose to include. When you later need a library with custom native code, or features that Expo Go does not support, you make a development build: your own version of Expo Go that includes your libraries. It is made with EAS Build or locally, and needs more setup. We cover building in *Build and publish to the Play Store*.
Common mistakes
Watch out for
- Putting text directly inside a
View. All text must be inside aTextcomponent. - Forgetting
flex: 1on the outer container, so the content does not fill the screen. - Installing packages with plain
npm installwhen an Expo package is needed. Usenpx expo install package-nameso Expo picks a version that matches your SDK. - Closing the terminal. The dev server must keep running while you test.
Try it: Make it a real counter
Extend the screen. Add a "Remove" button that lowers the count but never below 0. Show the price as well: a coffee costs ₹180 (the cappuccino from the Brew & Bean menu) so display "Total: ₹..." under the count. Change the button colour while the count is 0.
Key takeaways
- Create a project with
npx create-expo-app@latest, run it withnpx expo startand scan the QR code with Expo Go. - Screens live in the app folder. Edits show instantly with Fast Refresh.
- React Native uses View, Text and Pressable instead of HTML tags, and StyleSheet objects instead of CSS.
- Install packages with
npx expo installso versions match your Expo SDK. - Expo Go is for learning; a development build is needed for libraries with custom native code.
Check yourself
Finishing the quiz marks the lesson as done.
1. In React Native, where must text be placed?
2. What does npx expo start do?
3. Which command should you use to add a library to an Expo project?
4. Your phone shows no connection to the dev server. Which fix is most likely to work?
5. What is the main difference between onClick in web React and the equivalent in React Native?
Saved on this device. Create a free account to keep it on every device.
Practise this with Sam
A real mock interview, out loud, with an honest scorecard. Free to start.