Setting Up React Native
Getting started with React Native requires setting up your development environment. Let's walk through the process step by step for both iOS and Android development.
Prerequisites
Before you begin, make sure you have:
- Node.js: Version 18 or newer
- npm or yarn: Package manager for installing dependencies
- Git: For version control
Installation Options
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ React Native Setup Options โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Option 1: Expo (Recommended for Beginners) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ npx create-expo-app MyApp โ โ
โ โ cd MyApp โ โ
โ โ npx expo start โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Option 2: React Native CLI (Advanced) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ npx react-native init MyApp โ โ
โ โ cd MyApp โ โ
โ โ npx react-native run-android โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Using Expo (Recommended)
Expo is the easiest way to get started with React Native. It handles all the native configuration for you:
# Create a new Expo project
npx create-expo-app@latest MyFirstApp
# Navigate to your project
cd MyFirstApp
# Start the development server
npx expo start
Scan the QR code with your phone's camera (iOS) or Expo Go app (Android) to see your app running!
Project Structure
MyFirstApp/
โโโ app/ # App screens (Expo Router)
โโโ components/ # Reusable components
โโโ assets/ # Images, fonts, etc.
โโโ node_modules/ # Dependencies
โโโ app.json # Expo configuration
โโโ package.json # Project dependencies
โโโ tsconfig.json # TypeScript config