AKZN Notes

Archives for My Lazy and Forgetful Mind

General folder for react native (expo)

Last Modified on

When you initialize an Expo React Native app, it follows a specific folder structure to help you organize your code and assets efficiently. Here's the usual folder structure you'll find in an Expo React Native project:

your-project/
├── App.tsx                // Entry point of the app
├── app.json               // Configuration file for Expo
├── assets/                // Directory for static assets like images, fonts, etc.
│   ├── fonts/             // Place your custom fonts here
│   └── images/            // Store images here
├── components/            // Reusable components go here
├── constants/             // Store constant values or configuration settings here
├── navigation/            // Navigation-related files (e.g., React Navigation)
├── screens/               // Individual screens of your app
├── services/              // Services, utilities, and API calls
├── store/                 // State management (Redux, MobX) goes here
├── theme/                 // Styling, theming-related files
├── App.test.tsx           // Tests (if you add any)
├── package.json           // Project dependencies and scripts
└── node_modules/          // Installed npm packages (automatically generated)

Here's a brief explanation of each folder:

  • App.tsx: This file is the entry point of your Expo React Native app, and it's where you'll start building your app's UI and components.

  • app.json: The configuration file for your Expo project, where you can specify various settings like app name, version, permissions, icons, etc.

  • assets/: This directory is for storing static assets like images, fonts, and other media files used in your app.

  • components/: You can create reusable components here that can be used across different screens.

  • constants/: Store any constant values or configuration settings here to keep them organized.

  • navigation/: If you're using a navigation library (e.g., React Navigation), you can place your navigation-related files here.

  • screens/: This folder contains individual screens of your app, each representing a different screen or page.

  • services/: This directory is typically used for handling API calls, utility functions, and other services.

  • store/: If you're using state management like Redux or MobX, you can place the relevant files here.

  • theme/: In case you have theming or styling-related files, you can keep them here.

  • App.test.tsx: If you're writing tests for your app, you can store them in this file.

  • package.json: This file contains project dependencies, scripts, and other metadata about your project.

  • node_modules/: This folder is automatically generated when you install npm packages, and it contains the installed dependencies.

Remember that this is a common folder structure, and you can customize it to fit your specific project requirements and preferences. As you build your app, you may create additional folders or subdirectories to organize your code better.

Leave a Reply

Your email address will not be published.