Skip to main content
React Native Introduction
CHAPTER 02 Beginner

Setting Up React Native Development Environment

Updated: May 16, 2026
7 min read

# CHAPTER 2

Setting Up React Native Development Environment

1. Introduction

Setting up a mobile development environment is historically the most frustrating part of learning to build apps. You have to install heavy SDKs, configure system paths, and set up virtual emulators. Fortunately, the React Native community has created tools to drastically simplify this process. In this chapter, we will master Setting Up the React Native Development Environment. We will install Node.js, explain the critical difference between the Expo CLI and the React Native CLI, and configure our computers to run our very first mobile application.

2. Learning Objectives

By the end of this chapter, you will be able to:
  • Install Node.js and verify npm is working.
  • Understand the difference between Expo CLI and React Native CLI.
  • Install the Expo Go app on your physical mobile device.
  • Set up an Android Emulator using Android Studio (Optional but recommended).
  • Initialize a new React Native project.

3. Step 1: Installing Node.js

Because React Native uses JavaScript, your computer needs a JavaScript runtime engine.
  1. 1. Go to nodejs.org and download the LTS (Long Term Support) version for Windows or Mac.
  1. 2. Run the installer and accept all default settings.
  1. 3. To verify it worked, open your computer's terminal (or Command Prompt) and type: node -v
  1. 4. Also verify npm (Node Package Manager) by typing: npm -v

4. Expo CLI vs React Native CLI

There are two ways to build a React Native app. This is the most important decision you will make.

1. Expo CLI (Recommended for Beginners & 90% of Apps):

  • Pros: Incredibly easy setup. No need to install Android Studio or Xcode. You can test iOS apps on a Windows PC! It comes with pre-configured packages for Camera, Maps, and Notifications.
  • Cons: You don't have direct access to the native iOS/Android folders (unless you "eject" or use Expo prebuild).

2. React Native CLI (The "Bare Workflow"):

  • Pros: Full control. You have direct access to the android/ and ios/ folders to write custom Java or Swift code.
  • Cons: Setup takes hours. You MUST have a Mac to compile for iOS. Prone to frustrating native build errors.

*In this course, we will use Expo, as it is the official recommendation of the React Native core team for starting new projects.*

5. Step 2: Creating an Expo Project

You do not need to install Expo globally anymore. We will use npx (which comes with Node.js) to fetch and run the latest Expo tool instantly.
  1. 1. Open your terminal.
  1. 2. Navigate to your desktop (or coding folder): cd Desktop
  1. 3. Run the setup command:
bash
1
npx create-expo-app MyFirstApp
  1. 4. Wait for the tool to download the template and install the node modules.
  1. 5. Move into your new folder: cd MyFirstApp

6. Step 3: Running the App on a Physical Device

The absolute easiest way to test your app is on your actual phone. Emulators are heavy and slow down older computers.
  1. 1. Download the Expo Go app from the Apple App Store or Google Play Store on your physical phone.
  1. 2. Ensure your phone and your computer are connected to the exact same Wi-Fi network.
  1. 3. In your computer's terminal, start the local server:
bash
1
npx expo start
  1. 4. A massive QR code will appear in your terminal!
  1. 5. Open the Expo Go app on Android (or the Camera app on iPhone) and scan the QR code.
  1. 6. Your app will wirelessly bundle and appear on your phone!
If you want to code on one screen without looking down at your phone, you need an Emulator.
  • For Android (Windows/Mac): Download Android Studio. During installation, ensure "Android Virtual Device (AVD)" is checked. Open Android Studio -> Virtual Device Manager -> Create a Pixel phone emulator and launch it.
  • For iOS (Mac Only): Download Xcode from the Mac App Store. Open Xcode -> Go to Preferences -> Locations -> Ensure Command Line Tools are selected. Open the Simulator app.

Once your emulator is running, press a (for Android) or i (for iOS) in your npx expo start terminal, and Expo will automatically install the app onto the virtual phone!

8. Visual Learning: The Expo Workflow

txt
123456
[ VS Code ] -> Save App.js -> [ Node Server (Metro Bundler) ]
                                      |
                                  (Over Wi-Fi)
                                      |
                            [ Physical Phone running Expo Go ]
                            (Instantly refreshes the screen!)

9. Common Mistakes

  • Network Errors with Expo Go: If you scan the QR code and your phone says "Network Connection failed," it is almost always because your PC and phone are on different Wi-Fi networks (e.g., PC on Ethernet, phone on Wi-Fi, or a strict corporate firewall blocking local ports).
  • Fix: Connect both to the same Wi-Fi, or plug your phone into the PC via USB.

10. Best Practices

  • Use Visual Studio Code: Download VS Code as your code editor. Install the following extensions: ES7+ React/Redux/React-Native snippets (for code autocomplete) and Prettier (to format your code beautifully on save).

11. Practice Exercises

  1. 1. What command line tool provided by Node.js is used to instantly execute the create-expo-app script without installing it globally?
  1. 2. If you are developing on a Windows machine, can you view an iOS version of your app on a physical iPhone using Expo Go?

12. MCQs with Answers

Question 1

Why is the Expo CLI generally recommended over the React Native CLI for beginners and prototyping?

Question 2

When starting your development server using npx expo start, what software component is actually bundling your JavaScript code and serving it to your mobile device?

13. Interview Questions

  • Q: Explain the fundamental differences between a "Bare Workflow" (React Native CLI) and a "Managed Workflow" (Expo). In what specific scenario would a CTO be forced to eject from Expo to the Bare workflow?
  • Q: Walk me through the local network requirements and communication flow that allows the Expo Go app to instantly hot-reload JavaScript code from your computer's IDE to a physical mobile device.
  • Q: What is the node_modules folder, and why must it always be included in a .gitignore file?

14. FAQs

Q: Can I build a production, App Store-ready app using Expo? A: Absolutely! Years ago, Expo was considered just a prototyping tool. Today, Expo EAS (Expo Application Services) is the industry standard for compiling, signing, and deploying production-grade applications directly to the App Store and Google Play.

15. Summary

In Chapter 2, we conquered the hardest part of mobile development: the environment setup. We installed Node.js to provide our JavaScript runtime. We evaluated the critical choice between the React Native CLI (Bare workflow) and the Expo CLI (Managed workflow), choosing Expo for its rapid, cross-platform testing capabilities. Finally, we generated our first project, launched the Metro Bundler, and successfully executed our code on a mobile device via the Expo Go app.

16. Next Chapter Recommendation

Before we dive into React concepts, we must ensure our JavaScript foundation is rock solid. Proceed to Chapter 3: JavaScript Essentials for React Native.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·