Skip to main content
This tutorial will guide you through creating your first React Native app, understanding its structure, and making your first changes with Fast Refresh.
Make sure you’ve completed the environment setup before starting this tutorial.

Create a new project

Use the React Native CLI to create a new project:
This command creates a new React Native project with the following structure:
1

Navigate to your project

2

Install iOS dependencies (macOS only)

This installs CocoaPods dependencies required for iOS.
3

Start Metro bundler

Metro is React Native’s JavaScript bundler. Keep this terminal open.

Run your app

Open a new terminal and run:
This will:
  1. Build the native iOS app with Xcode
  2. Launch the iOS Simulator
  3. Install and run your app
Specify a device with --simulator="iPhone 15 Pro"
The first build can take 10-15 minutes as native dependencies compile. Subsequent builds are much faster.

Understanding the project structure

Entry point: index.js

This file registers your app with React Native:
index.js
Key concept: AppRegistry is the JavaScript entry point for all React Native apps. It registers your root component so the native code can load and run it.

Main component: App.tsx

Your app’s root component defines the UI:
App.tsx

Core components explained

SafeAreaView

Renders content within safe area boundaries, avoiding notches and system UI

View

The fundamental container component - equivalent to div in web development

Text

Displays text - all text must be wrapped in <Text> components

ScrollView

Scrollable container for content that exceeds screen bounds

Make your first changes

Let’s build a simple counter app to learn React Native fundamentals:
1

Add state with useState

Import useState and add counter state:
App.tsx
2

Add interactive buttons

Use Pressable for touchable buttons:
App.tsx
3

Style your components

Add styles using StyleSheet.create:
App.tsx
4

See live changes

Save the file and watch Fast Refresh update your app instantly!

Complete counter app

Here’s the full code for reference:

Key concepts learned

React Native components vs. HTML

In React Native, all text must be inside <Text> components. You cannot render raw strings directly in <View> components.

Styling with StyleSheet

React Native uses JavaScript objects for styling, similar to CSS-in-JS:
Key differences from CSS:
  • Property names use camelCase (backgroundColor not background-color)
  • No units for numeric values (they’re in density-independent pixels)
  • Flexbox is the default layout system
  • Limited subset of CSS properties

Platform-specific code

Write code that adapts to iOS and Android:

Fast Refresh in action

Fast Refresh automatically reloads your app when you save changes:
1

Component state is preserved

Your counter value stays the same when you edit styling or add new components
2

Full reload when needed

Fast Refresh triggers a full reload if you edit exported components or make syntax errors
3

Manual reload

Press R twice in the terminal running Metro, or shake the device and select “Reload”
To disable Fast Refresh: shake the device → Dev Menu → “Disable Fast Refresh”

Debugging your app

Chrome DevTools

Open the developer menu and select “Debug”:
Press Cmd + D or Device → Shake
Then select “Open Debugger” to use Chrome DevTools.

Console logs

Use standard console methods:
Logs appear in:
  • Metro bundler terminal
  • Chrome DevTools console
  • Xcode console (iOS)
  • Android Logcat (Android)

Next steps

Run on device

Test your app on a physical iPhone or Android device

Core components

Learn about built-in components like FlatList, Image, and TextInput

Navigation

Add multi-screen navigation with React Navigation

Networking

Fetch data from APIs with fetch() and handle responses

Common issues

Red screens indicate JavaScript errors. Read the error message carefully - it usually points to the exact line causing the issue.Common causes:
  • Syntax errors
  • Undefined variables
  • Incorrect imports
Yellow boxes show warnings that don’t crash the app but should be addressed:
  • Deprecated API usage
  • Performance warnings
  • Accessibility issues
If Metro isn’t connecting:
iOS: Clean build folder in Xcode (Shift + Cmd + K)Android: Clean Gradle cache