React Native Best Practices For Folder Structure

Understanding the folder structure and files of a React Native project is essential for efficient development. Below is a typical layout of a React Native project created using npx react-native init MyApp (with the default CLI, not Expo).
๐ React Native Folder Structure
MyApp/
โโโ __tests__/ # Jest unit test files
โโโ android/ # Native Android code (Java/Kotlin)
โโโ ios/ # Native iOS code (Objective-C/Swift)
โโโ node_modules/ # Project dependencies
โโโ src/ # Your appโs main source code (custom folder)
โ โโโ components/ # Reusable UI components
โ โโโ screens/ # App screens or views
โ โโโ navigation/ # Navigation setup (React Navigation etc.)
โ โโโ assets/ # Images, fonts, icons, etc.
โ โโโ utils/ # Helper functions or constants
โ โโโ App.js # Or the entry point if using `src` directly
โโโ App.js # Main entry JS file
โโโ index.js # App entry point for React Native
โโโ package.json # Project dependencies and scripts
โโโ babel.config.js # Babel compiler config
โโโ metro.config.js # Metro bundler config (optional)
โโโ .watchmanconfig # Watchman settings (for macOS dev)
โโโ .eslintrc.js # ESLint config (optional)
โโโ README.md # Project description
๐ Key Folders Explained
1. android/
- Contains all Android-specific native code.
- Structure resembles a standard Android project (with
build.gradle,AndroidManifest.xml, etc.). - Youโll touch this folder if integrating native modules or editing Gradle settings.
2. ios/
- iOS-specific code and Xcode project files (
*.xcodeprojor*.xcworkspace). - You use this folder to:
- Set up app icons and splash screens
- Add iOS native libraries
- Open in Xcode for iOS-specific configurations
3. src/ (optional but recommended)
- Contains your actual app logic, like:
- Components (buttons, headers)
- Screens (Home, Login)
- Navigation
- APIs, hooks, etc.
You can rename or restructure this to suit your project size.
๐ Key Files Explained
| File | Purpose |
|---|---|
| App.js | Main React component of the app. Often imports navigation and renders the first screen. |
| index.js | Entry point of the app for React Native. Registers the root component with AppRegistry. |
| package.json | Lists dependencies, scripts (e.g., start, android, ios), and metadata. |
| babel.config.js | Configures Babel (transpiler for React Native). |
| metro.config.js | (Optional) Configures the Metro bundler (e.g., for custom asset handling). |
| .eslintrc.js | Linting rules for JS/TS code (optional, but recommended). |
| tests/ | Default folder for Jest test cases. Can be deleted or restructured. |
โ Tips
- Use
src/to keep your root clean and your code organized. - Avoid putting all logic inside
App.jsโmove components intosrc/componentsand pages tosrc/screens. - Use TypeScript for better developer experience (
npx react-native init MyApp --template react-native-template-typescript).
Happy Coding!