What You’ll Build
A simple “Hello World” app that:- Displays a welcome screen
- Uses Expo Router for navigation
- Runs on iOS, Android, and web
- Updates instantly with Fast Refresh
Prerequisites
Before starting, make sure you have:
- Node.js 18+ installed
- A code editor (VS Code recommended)
- A phone with Expo Go installed OR iOS Simulator / Android Emulator
Step 1: Create the Project
Open your terminal and run:This creates a new Expo project with Expo Router pre-configured for file-based routing.
Step 2: Explore the Project Structure
Navigate into your project and open it in your editor:Key Files Explained
app.json - App Configuration
app.json - App Configuration
This file configures your app:Key settings:
app.json
name: App display nameslug: URL-friendly identifierversion: App versionicon: App icon (1024x1024px)scheme: Deep linking URL schemebundleIdentifier(iOS) /package(Android): Unique app identifier
package.json - Dependencies
package.json - Dependencies
package.json
main: Entry point (Expo Router)scripts: Common commandsdependencies: Runtime libraries
app/_layout.tsx - Root Layout
app/_layout.tsx - Root Layout
The root layout wraps all screens:This:
app/_layout.tsx
- Detects light/dark mode
- Provides theme to all screens
- Shows animated splash screen
- Sets up tab navigation
app/index.tsx - Home Screen
app/index.tsx - Home Screen
The main screen of your app:
app/index.tsx
Step 3: Start the Development Server
Run the development server:The server will continue running. Leave this terminal open and use a new terminal for other commands.
Step 4: Run on Your Device
- Physical Device
- iOS Simulator
- Android Emulator
- Web Browser
Using Your Phone
-
Install Expo Go:
- iOS: App Store
- Android: Play Store
-
Scan QR code:
- iOS: Use Camera app
- Android: Use Expo Go app
- App loads: Your app opens in Expo Go!
Step 5: Make Your First Change
With your app running, let’s make a change:1
Open app/index.tsx
Open the file in your editor
2
Change the title
Find this line:Change it to:
app/index.tsx
app/index.tsx
3
Save the file
Save (Cmd+S or Ctrl+S)
4
See instant update
Watch your app update automatically without losing any state!
This is Fast Refresh in action - one of Expo’s most powerful development features.
Step 6: Add a Button
Let’s add some interactivity:app/index.tsx
Notice how the
count state persists when you make changes? That’s Fast Refresh preserving your component state.Understanding What You Built
File-Based Routing
Your project uses Expo Router for navigation. Files in theapp/ directory automatically become routes:
Themed Components
The template includes themed components that automatically adapt to light/dark mode:<ThemedView>- View that changes background<ThemedText>- Text that changes color
components/ to see how they work.
Safe Areas
SafeAreaView ensures content doesn’t overlap with:
- iPhone notch
- Android navigation buttons
- Status bars
SafeAreaView.
Common Mistakes to Avoid
Forgetting SafeAreaView
Forgetting SafeAreaView
Without
SafeAreaView, content can be hidden behind the notch or status bar:Not using flex layouts
Not using flex layouts
React Native uses Flexbox for layout. Always set
flex: 1 on containers:Mixing styles
Mixing styles
Keep styles in
StyleSheet.create() for better performance:Project Customization
Change App Name
Editapp.json:
app.json
Change App Icon
- Create a 1024x1024px PNG image
- Save as
assets/images/icon.png - It’s already configured in
app.json:
Add Custom Fonts
The template already loads fonts inapp/_layout.tsx. To add more:
app/_layout.tsx
Next Steps
Congratulations! You’ve created your first Expo app and learned:- Project structure
- File-based routing
- Fast Refresh
- Running on multiple platforms
- Making changes and seeing updates
Add Navigation
Learn to navigate between screens
Core Concepts
Understand how Expo works
SDK Modules
Explore camera, location, and more
Build & Deploy
Ship your app to production
Troubleshooting
Can't connect to dev server
Can't connect to dev server
Try these solutions:
- Ensure same WiFi network
- Use tunnel mode:
npx expo start --tunnel - Check firewall settings
- Restart dev server
Metro bundler errors
Metro bundler errors
Clear the cache:
TypeScript errors
TypeScript errors
Install types: