MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
React Project Directory Structure and Entry Points0%
Study Materials
React.js for BeginnersProgress 0%
1.1Why React and Single-Page Architecture1.2Setting Up Modern React with Vite1.3React Project Directory Structure and Entry Points1.4Virtual DOM and React Render Cycle Explained
HomeTutorialsReact.js for BeginnersReact Project Directory Structure and Entry Points
Virtual DOM and React Render Cycle Explained

React Project Directory Structure and Entry Points

Beginner12 min read•Updated: 2026-11-18•By Er. Sumit Kumar (MSK Institute)
Study MaterialsCheatsheet

1. Anatomy of a Production React Project

When you scaffold a modern React application using Vite, a clean and standardized folder structure is created. Understanding the exact role of each file and folder ensures smooth collaboration and clean architectural scalability.

1msk-react-project/
2├── index.html # HTML shell hosting the root DOM container
3├── package.json # Manifest of scripts and dependencies
4├── vite.config.js # Vite build and plugin configuration
5├── public/ # Static assets served untouched at root URL
6│ └── favicon.ico # Browser tab icon
7└── src/ # Application source code
8 ├── main.jsx # Application entry point (mounts React to DOM)
9 ├── App.jsx # Top-level root React component
10 ├── App.css # Component-specific styles for App
11 ├── index.css # Global CSS reset and typography
12 └── assets/ # Bundled images, SVGs, and fonts

2. The HTML Host: index.html

Unlike older bundlers where index.html resided in a hidden public folder, Vite treats index.html as the project's direct entry point at the root level.

1<!doctype html>
2<html lang="en">
3 <head>
4 <meta charset="UTF-8" />
5 <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7 <title>MSK Institute React App</title>
8 </head>
9 <body>
10 <!-- The mount target: React controls all children inside this element -->
11 <div id="root"></div>
12 
13 <!-- The script module that bootstraps React -->
14 <script type="module" src="/src/main.jsx"></script>
15 </body>
16</html>

The <div id="root"></div> serves as the container where React mounts its component tree. Notice the direct <script type="module" src="/src/main.jsx"></script> tag, which gives Vite immediate visibility into the JavaScript entry point.

3. The React Entry Point: src/main.jsx

In main.jsx, React establishes its bridge to the browser's Document Object Model using react-dom/client:

1import React from 'react';
2import ReactDOM from 'react-dom/client';
3import App from './App.jsx';
4import './index.css';
5 
6// 1. Locate the physical DOM node
7const rootElement = document.getElementById('root');
8 
9// 2. Create the React concurrent root
10const root = ReactDOM.createRoot(rootElement);
11 
12// 3. Render the root component tree into the container
13root.render(
14 <React.StrictMode>
15 <App />
16 </React.StrictMode>
17);

Key Elements of main.jsx:

  • createRoot (React 18+): Creates a modern concurrent root container. This unlocks automatic batching of state updates and concurrent rendering capabilities.
  • <React.StrictMode>: A development-only wrapper that helps surface potential side-effect bugs, deprecated APIs, and uncleaned timers by intentionally invoking component render functions twice in local development. It is completely inactive in production builds.

4. The Root Component: src/App.jsx

App.jsx is the topmost React component in your application hierarchy. It imports child components, coordinates global layouts, and returns JSX markup:

1import React from 'react';
2 
3export default function App() {
4 return (
5 <div className="app-container">
6 <header>
7 <h1>Welcome to MSK Institute React Mastery</h1>
8 <p>Mastering modern front-end web engineering.</p>
9 </header>
10 </div>
11 );
12}

5. public/ vs src/assets/

Front-end engineers often confuse static asset locations:

  • public/: Files placed here (e.g., robots.txt, favicon.ico) are served directly at the root path (/favicon.ico). They are not processed or hashed by Vite's build pipeline.
  • src/assets/: Images, fonts, and stylesheets placed here are imported directly into JavaScript files (import logo from './assets/logo.png'). Vite hashes their filenames for long-term browser cache invalidation (logo.8f3a12.png) and inlines small images as base64 data URIs.

Interactive Quiz• Knowledge Check

Practice Quiz

Question 1
In a modern Vite React application, where is the index.html file located?
Question 2
What is the primary purpose of ReactDOM.createRoot in React 18+?
Question 3
What does <React.StrictMode> do during development?
Question 4
Why should production image assets generally be imported from src/assets/ rather than referenced from public/?
Question 5
What is the standard HTML id used by conventional React starters to mount the root application component?
Next Lesson

Virtual DOM and React Render Cycle Explained

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
Setting Up Modern React with ViteVirtual DOM and React Render Cycle Explained

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

Mentor-Led Practical Training

Master React.js for Beginners with Hands-On Projects

Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext