Skip to content
Tutorials Center
My learning

Topics

Lesson 2 of 38 ยท Getting Started

Create Your First Expo App

Create an Expo project with create-expo-app, understand every folder and file in the default template, edit your first screen and learn how components become native views.

You need very little to start: Node.js (an LTS version), a code editor and a phone or simulator. One command creates a complete project, and another starts it. This lesson walks through the generated project so none of the files feel mysterious, then you will write your first screen.

Commands and project files are shown read-only (the real Expo CLI cannot run in a browser). The live examples model how React-style components turn into a tree of native-like views.

Create the project

Terminal
npx create-expo-app@latest my-app
cd my-app
npx expo start

create-expo-app downloads a template and installs dependencies. The default template already uses TypeScript, Expo Router and a tab layout with example screens. You can pick others:

Terminal
npx create-expo-app@latest --template blank        # one screen, no router
npx create-expo-app@latest --template blank-typescript
npx create-expo-app@latest --template tabs         # tab navigation example

If you want to start clean from the default template, run the reset script it provides:

Terminal
npm run reset-project

It moves the sample code to an app-example/ folder and leaves an empty app/ with one index.tsx and a _layout.tsx.

The project layout

Text
my-app/
  app/                 routes: every file here is a screen
    _layout.tsx        root layout (wraps all screens)
    index.tsx          the "/" screen
    (tabs)/...         a route group that holds a tab bar
  assets/              images, fonts
  components/          your own reusable components
  constants/           colors, spacing values
  hooks/               custom hooks
  app.json             project configuration
  package.json         dependencies and scripts
  tsconfig.json        TypeScript settings (with the "@/" alias)

Newer templates may put these folders under src/; the rules are the same. The important ones:

  • app/ is special: Expo Router turns each file into a route (File-Based Routing).
  • app.json (or app.config.ts) describes the app: name, icon, bundle identifiers, plugins (App Configuration).
  • package.json has "main": "expo-router/entry" and scripts such as start, android, ios and web.
  • There is no ios/ or android/ folder yet. They are generated on demand (Prebuild and Config Plugins).

Your first screen

Open app/index.tsx and replace it:

TSX
import { View, Text, StyleSheet } from 'react-native';

export default function HomeScreen() {
  return (
    <View style={styles.container}>
      <Text style={styles.title}>Hello, Expo!</Text>
      <Text>Edit app/index.tsx and save to see this change.</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1, alignItems: 'center', justifyContent: 'center', padding: 24 },
  title: { fontSize: 28, fontWeight: '700', marginBottom: 8 },
});

Three things to notice:

  1. The file default-exports a component. That is the screen for the route.
  2. There are no div or p tags. React Native provides View (a container) and Text (all text must be inside it). See Core Components.
  3. Styles are JavaScript objects, written in camelCase (fontSize, not font-size), and flex layout is the default (Styling and Flexbox).

From components to a native tree

When your component renders, React produces a tree of elements. React Native then creates one native view per View, one text view per Text, and so on. The next stand-in builds the same kind of tree and prints it, so you can see what the renderer sees.

JS A component tree, printed

Press Run (or Ctrl + Enter) to see the console output here.

No output.

A project tree helper

Routes come from file paths, so it helps to read paths as trees. This stand-in prints a list of project files as a tree, the way a file explorer would.

JS Print a project as a tree

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Useful scripts and habits

  • npx expo start starts the dev server. Press a (Android), i (iOS simulator) or w (web) in the terminal, or scan the QR code with a phone.
  • npx expo install <package> installs a library at the version that matches your SDK. Prefer it over npm install for Expo and React Native libraries; mismatched versions are a classic cause of crashes.
  • npx expo-doctor checks your project for common problems (missing or mismatched dependencies, bad config).
  • npx expo lint runs the preconfigured ESLint rules.

Commit package.json and app.json to Git, but not node_modules/, and not ios/ / android/ if you use prebuild. The default .gitignore already does this.

Common mistakes

  • Text outside <Text>: raw strings inside a View crash the app with an error. Wrap them.
  • Using web tags: div, span, img do not exist (outside of Expo's web-only DOM components). Use View, Text, Image.
  • Forgetting a default export in a route file: the screen is empty or the router warns.
  • Plain npm install for native libraries: use npx expo install.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which command creates a new Expo project with the default template?

    create-expo-app is the current way to scaffold a project.
  2. 2. What is special about the app/ folder?

    Expo Router builds the navigation from the files in app/.
  3. 3. Why use npx expo install instead of npm install for libraries like expo-camera?

    Expo and React Native libraries must match the SDK version; expo install selects it for you.
  4. 4. Where must all visible text be placed?

    React Native only renders strings inside Text.

Summary

  • create-expo-app gives you a TypeScript project with Expo Router; expo start runs it.
  • app/ holds routes, app.json the configuration; ios/ and android/ are generated later.
  • Screens are default-exported components built from View, Text and styles written as objects.
  • Use npx expo install for libraries and npx expo-doctor for health checks.

Next: Running on Devices