Step-by-Step Guide to Building a Mobile App with React Native
React Native lets you build native mobile apps for iOS and Android using JavaScript and React. Instead of writing separate codebases, you share most of your logic and UI components. This guide walks you through the essential steps to create your first app from scratch.
Before you start, ensure you have Node.js (v14 or later) and a code editor installed. You’ll also need either Expo (easier for beginners) or the React Native CLI. For this tutorial, we’ll use Expo because it simplifies the build process.
1. Set Up Your Development Environment
Install the Expo CLI globally by running npm install -g expo-cli in your terminal. Then create a new project with expo init MyFirstApp. Choose the “blank” template for a clean start. Once created, navigate into the folder and run expo start to launch the development server. Open the Expo Go app on your phone to scan the QR code — your app will reload automatically as you edit code.
2. Understand the Project Structure
Your project contains key files:
- App.js – the main entry point where you write your UI.
- package.json – manages dependencies.
- app.json – configuration for your app name, icon, and splash screen.
- assets/ – folder for images and fonts.
All your components and screens go into separate files inside a src/ folder for better organization.
3. Build Your First Screen with Core Components
React Native provides essential components like View, Text, TextInput, and Button. In App.js, replace the default code with:
import { View, Text, StyleSheet } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<Text>Hello, React Native!</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#f0f0f0',
},
});
Notice you use StyleSheet.create for styling — it’s similar to CSS but uses camelCase properties (e.g., backgroundColor).
4. Add Navigation and Manage State
For navigation between screens, install React Navigation: npm install @react-navigation/native @react-navigation/stack. Then wrap your app in a NavigationContainer and define stack screens. For state, use React’s useState hook inside your components. Example:
import React, { useState } from 'react';
import { TextInput, Button } from 'react-native';
const [text, setText] = useState('');
This pattern lets you manage user input and app data across screens.
Conclusion
You now have a functional React Native app with navigation and basic state management. Test it on real devices using Expo Go, then move on to adding features like APIs, push notifications, or platform-specific code. Building with React Native is fast, flexible, and perfect for cross-platform mobile development.