Skip to content

Latest commit

 

History

History
65 lines (36 loc) · 2.71 KB

File-structure-react.md

File metadata and controls

65 lines (36 loc) · 2.71 KB
European Flag

Euroguessr: File Structure for a React Project (Best Practice)

Version 0.1 .NET Logo License React

Main Directories

src/

The src/ (source) directory is usually the main directory where all the React application source code resides.

public/ 📢

The public/ directory contains the static resources of the application, such as HTML files, images, icons, etc. These files are publicly accessible and can be referenced in the code.

Directories Inside src/

components/ 📁

The components/ directory contains reusable components of the application. These components can be UI elements like buttons, cards, forms, etc.

pages/ 📄

The pages/ directory generally contains components representing individual pages of the application. Each file corresponds to a specific route in the application.

utils/ 🛠️

The utils/ directory may contain utility functions, helpers, or other reusable logic that is not directly tied to specific components.

styles/ 🎨

The styles/ directory contains the application's style sheets, such as CSS files, SASS, or any other CSS preprocessor used.

assets/ 📁

The assets/ directory can be used to store other static resources like images, font files, JSON files, etc.

context/ 📁

The context/ directory may contain React contexts used for managing data and shared states between different components.

hooks/ 🎣

The hooks/ directory may contain reusable custom hooks created with React Hooks to abstract complex logic and share functionality between different components.

services/ 📡

The services/ directory may contain services or functions that make network requests, manage global state, or interact with external APIs.

tests/ 🧪

The tests/ directory may contain test files for components, hooks, or other parts of the application.

config/ ⚙️

The config/ directory may contain configuration files for different environment variables, webpack configuration, or any other application-specific settings.

Notes

  • This structure is an example and may vary based on the specific needs of each project or the development team's preferences.
  • It's essential to maintain code consistency and readability by logically organizing files and directories.