After installing React Native and running your first app, the next step is to understand the project structure. Knowing where files live, what they do, and how React Native organizes code will save you hours of confusion as your project grows.
When you run npx react-native init MyFirstApp, you get a folder layout like this:
MyFirstApp/
β
βββ android/ # Native Android code (Gradle, Java/Kotlin)
βββ ios/ # Native iOS code (Xcode, Swift/Obj-C)
βββ node_modules/ # Installed npm dependencies
βββ index.js # Entry point of the app
βββ App.js # Main React component (your app starts here)
βββ package.json # Project metadata + dependencies
βββ app.json # Basic app configuration
βββ babel.config.js # Babel compiler configuration
βββ metro.config.js # Metro bundler configuration (optional)
Letβs go through each of these step by step π
Gradle for builds, and code can be written in Java or Kotlin.Xcode.This is the heart of your React Native app. All your React components eventually connect here.
import React from "react";
import { Text, View } from "react-native";
export default function App() {
return (
Hello, React Native π
);
}
Acts as the entry point. It tells React Native which component to start with.
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
AppRegistry.registerComponent(appName, () => App);
Defines project metadata, dependencies, and useful scripts.
{
"name": "MyFirstApp",
"version": "0.0.1",
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios"
},
"dependencies": {
"react": "18.x",
"react-native": "0.79.x"
}
}
Basic config file that defines the appβs name and displayName.
{
"name": "MyFirstApp",
"displayName": "My First App"
}
Controls how modern JavaScript is compiled into code React Native can understand.
Configuration for Metro (the JavaScript bundler used by React Native). Useful when you need to add support for images, custom fonts, or file types.
If you use Expo instead of React Native CLI, the structure is simpler:
MyExpoApp/
βββ App.js
βββ package.json
βββ app.json
βββ node_modules/
No android/ or ios/ folders β Expo manages native code for you.
src/ folder for your actual code.src/, create:
components/ β Reusable UI piecesscreens/ β Full-screen pagesassets/ β Images, fonts, iconsutils/ β Helper functions| Folder/File | Purpose |
|---|---|
android/ |
Native Android code (Gradle, Java, Kotlin) |
ios/ |
Native iOS code (Xcode, Swift, Objective-C) |
App.js |
Main React component, app UI starts here |
index.js |
Entry point (registers the root component) |
package.json |
Dependencies, scripts, metadata |
app.json |
Basic app configuration |
babel.config.js |
Transpiler configuration |
metro.config.js |
Bundler configuration |
By understanding the React Native project structure, youβll be more confident in navigating and scaling your app. In the next step, weβll dive into Core Components and Styling β the building blocks of every React Native application.