Installation
This guide walks you through the process of installing React Native and setting up your development environment. By the end of this guide, you'll be ready to start building your first React Native application.
Prerequisites
Before proceeding with the installation, make sure you have the following software and tools installed:
- Node.js and npm
- Git
- Watchman (Optional but recommended)
- JDK (For Android development)
- Android Studio (For Android development)
- Xcode (For iOS development, macOS only)
If you haven't installed these yet, please refer to the Prerequisites guide.
Installation Steps
Step 1: Install Node.js and npm
If you haven't installed Node.js and npm yet, download and install them from the official Node.js website.
Verify the installation by running the following commands in your terminal:
node -v
npm -v
Step 2: Install React Native CLI
You can install the React Native command-line interface (CLI) using npm:
npm install -g react-native-cli
Verify the installation:
react-native --version
Step 3: Create a New React Native Project
To create a new React Native project, run the following command:
react-native init MyNewProject
This will create a new directory called MyNewProject
with all the files you need.
Step 4: Run Your React Native Project
Navigate into your project directory:
cd MyNewProject
To run your project on iOS:
react-native run-ios
To run your project on Android:
react-native run-android
Optional: Using Expo CLI
If you prefer to use Expo for your React Native development, you can install the Expo CLI:
npm install -g expo-cli
To create a new Expo project:
expo init MyNewExpoProject
To run your Expo project:
cd MyNewExpoProject
expo start
Next Steps
Congratulations, you've successfully installed React Native and set up your development environment! You're now ready to start building your first React Native application. For more guidance, check out the Getting Started guide.
Book a conversation with us for personalize training today!