The Backstory
Recently, my office assigned me to work on a React Native project. I had zero experience with mobile development—my background is entirely in web development with the MERN stack (MongoDB, Express, React, Node.js). I didn't know React Native existed until this assignment came up.
Instead of panicking, I decided to learn by doing. I'm documenting everything I learn and sharing it here, hoping it helps other developers who are in the same boat—familiar with React but new to mobile development.
In this first blog post, I'll walk you through setting up a React Native development environment on Windows and compare it with what you already know from React web development.
What is React Native?
If you know React, you're already 80% there. React Native is React, but instead of rendering to the DOM (like in web browsers), it renders to native mobile components.
React Web:
<div>Hello World</div> // Renders as HTML <div>
React Native:
<View>Hello World</View> // Renders as native Android/iOS View
The core concepts are the same: components, props, state, hooks, JSX. The difference is the components and styling approach.
Phase 1: Environment Setup - React vs React Native
Let me break down what I did and compare it to setting up a React web project.
Step 1: Node.js Installation ✅
React (Web):
# You already have this if you do React web dev
node -v # v20.19.3
npm -v # 10.8.2
React Native:
- Same thing! Node.js is required for both.
- I verified my Node.js installation:
v20.19.3(LTS version) - npm version:
10.8.2
Takeaway: If you can run npm install and npm start for React, you're good here.
Step 2: Git Installation ✅
React (Web):
git --version # You probably already have this
React Native:
- Same thing! Git is needed for version control.
- I verified:
git version 2.46.0.windows.1
Takeaway: No difference. You already have Git if you're doing web development.
Step 3: Code Editor Setup ✅
React (Web):
- VS Code with extensions: ESLint, Prettier, TypeScript support
React Native:
-
Same extensions! I installed:
- ESLint (for linting)
- Prettier (for code formatting)
- TypeScript support (built-in or via extensions)
Takeaway: Your existing VS Code setup works perfectly for React Native.
Step 4: The Big Difference - Mobile Emulator Setup 📱
React (Web):
- You just need a browser (Chrome, Firefox, etc.)
- That's it. No additional setup.
React Native:
- You need an Android emulator or iOS simulator to test your app
- I installed Android Studio (this is the new part!)
What I Did:
- Downloaded Android Studio from developer.android.com/studio
- This is a large download (~1GB) and takes 20-30 minutes
- During installation, made sure these were checked:
- Android SDK
- Android SDK Platform-Tools
- Android Virtual Device (AVD)
- After installation:
- Opened Android Studio → SDK Manager
- Installed the latest Android SDK Platform
- Created a virtual device (Pixel 6 Pro) via AVD Manager
-
Set up environment variables (Windows):
- Added
ANDROID_HOME=C:\Users\HP\AppData\Local\Android\Sdk - Added to PATH:
%ANDROID_HOME%\platform-toolsand%ANDROID_HOME%\emulator
- Added
Why This Matters:
- In React web dev, you run
npm startand openlocalhost:3000in your browser - In React Native, you run the app and it opens in an emulator (a virtual phone on your computer)
The Comparison:
React Web: npm start → Browser (localhost:3000)
React Native: npm start → Android Emulator (virtual phone)
Step 5: Creating Your First Project
React (Web):
npx create-react-app my-app
cd my-app
npm start
# Opens browser automatically
React Native (with Expo):
npx create-expo-app physio-care --template
# When prompted, select: Blank (TypeScript)
cd physio-care
npm install
npm start
# Shows QR code and options to run on emulator
Key Differences:
- Template Selection:
- React:
create-react-apphas one default template - React Native: Expo asks you to choose (Blank, TypeScript, Navigation, etc.)
- Starting the Dev Server:
- React: Opens browser automatically
- React Native: Shows a QR code and menu with options:
- Press
afor Android emulator - Press
ifor iOS simulator - Press
wfor web browser - Scan QR code for physical device
- Press
-
What You See:
- React: Browser window with your app
- React Native: A phone emulator window with your app
The Project Structure Comparison
React (Web) - Typical Structure:
my-react-app/
├── public/
│ └── index.html
├── src/
│ ├── App.js
│ ├── index.js
│ └── components/
├── package.json
└── node_modules/
React Native (Expo) - What I Created:
physio-care/
├── .expo/ # Expo build cache and config
├── assets/ # Images, icons (instead of public/)
│ ├── icon.png
│ ├── splash-icon.png
│ ├── adaptive-icon.png
│ └── favicon.png
├── node_modules/ # Dependencies (same as React)
├── .gitignore # Git ignore rules
├── App.tsx # Main component (similar to App.js)
├── index.ts # Entry point (similar to index.js)
├── app.json # App configuration (like package.json but for mobile)
├── package.json # Dependencies (same as React)
├── package-lock.json # Lock file (same as React)
└── tsconfig.json # TypeScript configuration
Key Differences:
No
public/folder: Mobile apps don't have HTML files. Instead, you haveassets/for images and icons.app.jsoninstead ofindex.html:
- React:
public/index.htmldefines your HTML structure - React Native:
app.jsondefines app metadata (name, version, orientation, etc.)
- Entry Point:
- React:
src/index.jsrenders to#rootdiv - React Native:
index.tsregisters the app component
-
Additional Files:
-
.expo/folder: Contains Expo build cache and configuration (similar to.next/in Next.js or.vite/in Vite) -
tsconfig.json: TypeScript configuration (same as React projects using TypeScript) -
.gitignore: Standard Git ignore file (same as React projects)
-
The Code Comparison
React (Web) - App.js:
import React from "react";
function App() {
return (
<div className="container">
<h1>Hello World</h1>
</div>
);
}
export default App;
React Native - App.tsx (What I Created):
import { StatusBar } from "expo-status-bar";
import { StyleSheet, Text, View } from "react-native";
export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.tsx to start working on your app!</Text>
<StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});
What Changed:
- Components:
-
<div>→<View>(container component) -
<h1>,<p>, etc. →<Text>(all text must be in Text component) - No
<span>,<section>, etc.
- Styling:
-
className→styleprop (inline styles or StyleSheet) - CSS classes → JavaScript objects
- No CSS files (you can use them, but StyleSheet is preferred)
-
Imports:
-
react-nativeinstead of justreact -
expo-status-barfor status bar control (mobile-specific)
-
Running the App - Side by Side
React Web:
npm start
# Automatically opens http://localhost:3000
# You see your app in Chrome/Firefox
React Native:
npm start
# Shows QR code and menu:
# › Press a │ open Android
# › Press w │ open web
#
# After pressing 'a':
# - Android emulator opens
# - App installs and runs on emulator
# - You see your app in a phone window
The Experience:
- React: Browser tab with your app
- React Native: A phone window (emulator) with your app running like a real mobile app
What I Learned: Key Takeaways
React Native is React: If you know React, you know 80% of React Native. The mental model is identical.
The Setup is Different:
- React: Browser is your "device"
- React Native: Emulator/simulator is your "device"
- This requires Android Studio (for Android) or Xcode (for iOS)
- Components are Different:
- No HTML elements (
div,span,h1) - Use React Native components (
View,Text,Button) - Styling is JavaScript objects, not CSS classes
- Expo Makes It Easier:
- Expo is like
create-react-appfor React Native - It handles a lot of configuration for you
- You can test on real devices via QR code scanning
-
The Development Loop is Similar:
- Edit code → Save → App reloads (hot reload)
- Same as React web development!
Common Questions (If You're Coming from React)
Q: Do I need to learn a completely new language?
A: No! It's still JavaScript/TypeScript. Same syntax, same concepts.
Q: Can I use my existing React knowledge?
A: Yes! Components, props, state, hooks, context—all work the same way.
Q: What about npm packages?
A: Some work (utility libraries), but UI libraries need to be React Native compatible. Check if a package supports React Native before installing.
Q: How do I debug?
A: Similar to React—console.log works, React DevTools can be used, and Expo provides debugging tools.
Q: Can I use TypeScript?
A: Yes! I used the TypeScript template. It's the same TypeScript you know from React.
Resources That Helped Me
- Expo Documentation - Excellent starting point
- React Native Documentation - Official docs
- React Native for Web Developers - Great comparison guide
Code Repository
All the code from this learning journey is available on GitHub:
- physio-care-react-native-first-project - Complete source code for the PhysioCare React Native app
Final Thoughts
If you're a React developer thinking about mobile development, don't be intimidated. The learning curve is much smaller than you think. The hardest part was setting up Android Studio and the emulator—everything else feels familiar.
The best part? You can build apps for both Android and iOS with one codebase. That's the power of React Native.
Stay tuned for Phase 2, where I'll build the actual app features and compare navigation with React Router!
About This Series:
I'm learning React Native by building a physiotherapy patient management app. Each phase will be documented with comparisons to web development concepts I already know. Follow along if you're in the same boat!
Top comments (0)