Set up your development environment, create your first Expo project, and run it on a device.
Prerequisites
- Node.js 18+ (LTS recommended)
- Git for version control
- Expo CLI:
npm install -g expo-cli - Expo Go app on your phone (iOS App Store / Google Play Store)
Create Your First Project
# Create a new Expo project with the default template
npx create-expo-app@latest my-mobile-app
# Navigate to the project
cd my-mobile-app
# Start the development server
npx expo startProject Structure
my-mobile-app/
├── app/ # Expo Router file-based routing
│ ├── _layout.tsx # Root layout
│ ├── index.tsx # Home screen
│ └── +not-found.tsx # 404 screen
├── assets/ # Images, fonts, static files
├── components/ # Reusable UI components
├── constants/ # Theme, colors, spacing
├── hooks/ # Custom React hooks
├── package.json
├── app.json # Expo config
├── tsconfig.json
└── .gitignore
Running on a Physical Device
Option 1: Expo Go (Quick Start)
- Install Expo Go on your phone
- Run
npx expo startin terminal - Scan the QR code with:
- iOS: Camera app → tap notification
- Android: Expo Go app → "Scan QR Code"
Option 2: Development Build (For Native Modules)
Expo Go doesn't support all native modules. For production apps, create a development build:
# Install EAS CLI
npm install -g eas-cli
# Login to Expo
eas login
# Configure project
eas build:configure
# Create development build for iOS
eas build --profile development --platform ios
# Create development build for Android
eas build --profile development --platform androidRunning on Emulators/Simulators
# iOS Simulator (macOS only)
npx expo start --ios
# Android Emulator
npx expo start --android
# Web browser
npx expo start --webKey Files Explained
app.json - Expo Configuration
{
"expo": {
"name": "My Mobile App",
"slug": "my-mobile-app",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.yourname.myapp"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#ffffff"
},
"package": "com.yourname.myapp"
},
"web": {
"favicon": "./assets/favicon.png"
},
"plugins": [
"expo-router"
],
"experiments": {
"typedRoutes": true
}
}
}app/_layout.tsx - Root Layout
import { Stack } from 'expo-router';
import { Providers } from '@/providers';
export default function RootLayout() {
return (
<Providers>
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="index" />
<Stack.Screen name="(auth)/login" />
<Stack.Screen name="(app)/home" />
</Stack>
</Providers>
);
}app/index.tsx - Home Screen
import { View, Text, StyleSheet } from 'react-native';
import { Link } from 'expo-router';
export default function HomeScreen() {
return (
<View style={styles.container}>
<Text style={styles.title}>Welcome to Expo! 👋</Text>
<Text style={styles.subtitle}>
Edit <Text style={styles.code}>app/index.tsx</Text> to get started.
</Text>
<Link href="/(app)/home" className="button">
<Text style={styles.buttonText}>Enter App</Text>
</Link>
</View>
);
}
const styles = StyleSheet.create({
container: { flex: 1, justifyContent: 'center', alignItems: 'center', padding: 24 },
title: { fontSize: 32, fontWeight: '700', marginBottom: 8 },
subtitle: { fontSize: 16, color: '#666', textAlign: 'center', marginBottom: 24 },
code: { fontFamily: 'monospace', backgroundColor: '#f0f0f0', padding: '2px 6px', borderRadius: 4 },
buttonText: { color: '#fff', fontSize: 16, fontWeight: '600' },
});Development Workflow
Edit code → Hot Reload (automatic) → Test on device → Commit → Push
Hot Reload vs Fast Refresh
- Fast Refresh (default): Preserves React state, updates UI instantly
- Hot Reload: Full reload, loses state (fallback for certain changes)
Debugging
# Open React Native DevTools
npx expo start --dev-client
# In Chrome: Open DevTools → Console tab
# Or press 'j' in terminal to open debuggerTypeScript Setup
Expo projects use TypeScript by default. Key configs:
// tsconfig.json
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true,
"jsx": "react-jsx",
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
}
}Common Issues
| Issue | Solution |
|---|---|
| Metro bundler won't start | Kill process on port 8081: lsof -ti:8081 | xargs kill -9 |
| QR code not scanning | Ensure phone and computer on same WiFi. Try npx expo start --tunnel |
| Module not found | Clear cache: npx expo start -c |
| iOS Simulator not opening | Xcode → Window → Devices and Simulators → ensure simulator exists |
Next Steps
- Explore the file structure - Understand Expo Router conventions
- Add a screen - Create
app/about.tsxwith a simple component - Style with StyleSheet - Learn React Native styling (next lesson)
- Run on device - Test with Expo Go on your phone
Run the commands above. Scan QR code with Expo Go. Modify app/index.tsx and see hot reload.
npx create-expo-app@latest my-first-app
cd my-first-app
npx expo startBuild a two-screen app
- Create
app/about.tsxwith an About screen - Add navigation from Home to About using
<Link href="/about"> - Style both screens with a consistent theme
- Test on physical device with Expo Go
Expo abstracts away native build complexity. Start with Expo Go for rapid iteration, migrate to development builds when you need custom native modules. File-based routing with Expo Router makes navigation intuitive for React developers.
Resources
- React Native Getting Started: https://reactnative.dev/docs/getting-started
- Expo Create a Project: https://docs.expo.dev/get-started/create-a-project/
- Expo Router Introduction: https://docs.expo.dev/router/introduction/
- Expo CLI Reference: https://docs.expo.dev/workflow/expo-cli/