How to Get Started with React Native: A Step-by-Step Guide for Creating, Running, and Modifying Your Project in App.tsx
- Ruben van Breda
- Apr 2
- 3 min read
React Native has emerged as a leading framework for building mobile applications using JavaScript and React. With it, developers can create applications that function on both iOS and Android platforms while enjoying the perks of native performance. If you want to venture into mobile application development, this guide will help you create your first project, run it successfully, and modify the App.tsx file effectively.
Setting Up Your Development Environment
Before you jump into coding, you need to set up your development environment. Begin with installing Node.js, which is essential for React Native. You can grab it from the Node.js official website. As of October 2023, the latest version is 18.0.0, but check the website for updates.
Once Node.js is installed, you need to install the React Native CLI globally. Open your terminal and run:
```bash
npm install -g react-native-cli
```
After the installation, you are ready to create your first React Native project!
Creating Your First React Native Project
To create a new project, use the following command in your terminal:
```bash
npx react-native init MyFirstApp
```
Replace "MyFirstApp" with your preferred project name. This command sets up a new directory containing all necessary files and dependencies for your app.
After the project setup is complete, navigate into your project directory:
```bash
cd MyFirstApp
```
Running Your Project
Now it’s time to run your React Native application. You need to start the Metro Bundler, a JavaScript bundler specifically for React Native. In your terminal, execute:
```bash
npx react-native start
```
Open another terminal window to run your app on an Android emulator or a connected Android device using:
```bash
npx react-native run-android
```
If you want to run it on iOS, simply run:
```bash
npx react-native run-ios
```
This process compiles your app and launches it in the emulator or on your device, giving you a firsthand look at your application in action. In a recent survey, 63% of developers reported enjoying the fast reload feature of React Native, which allows instant updates during development.
Modifying App.tsx
With your application running, it’s time to customize the default `App.tsx` file. Open the `App.tsx` file located at the root of your project in your preferred code editor.
Inside, you will find some basic code. The structure of this file is a functional component that returns a simple view. You can easily modify the content and styles. Here’s a straightforward example of how to change it:
```javascript
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
const App = () => {
return (
<View style={styles.container}>
<Text style={styles.title}>Welcome to My First React Native App!</Text>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fff',
},
title: {
fontSize: 20,
fontWeight: 'bold',
},
});
export default App;
```
After you save the changes, the application will refresh automatically to display your updates. It’s a real-time feedback loop that many developers appreciate.

Getting Started Doesn’t Have to Be Overwhelming
Starting with React Native is easier than you may think. By following these steps—setting up your environment, creating and running a project, and modifying the App.tsx file—you are well on your way to developing impressive mobile applications. Always refer to the official React Native documentation for deeper insights and best practices. Enjoy your coding journey!
Comments