Menu

React Project Structure: Files, Folders & main.jsx Explained

Understanding the React Project Structure

What is in the Project Folder?

student-dashboard/
├── node_modules/
├── public/
│   └── vite.svg
├── src/
│   ├── assets/
│   ├── App.css
│   ├── App.jsx
│   ├── index.css
│   └── main.jsx
├── .gitignore
├── index.html
├── package.json
└── vite.config.js

What Each Part Does

File or folder

Purpose

node_modules/All installed libraries. Never edit this. Never upload it anywhere.
public/Static files served as-is (images, favicon)
src/Your code lives here. This is where you will spend all your time.
src/main.jsxThe entry point  connects React to the HTML page
src/App.jsxThe root component of your application
src/index.cssGlobal styles for the whole app
index.htmlThe single HTML page your app loads into
package.jsonLists your dependencies and the commands you can run
vite.config.jsVite's configuration

The Two Files That Matter Most

index.html

<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>

This is the entire body of your HTML file. One empty div. React fills it in.

src/main.jsx

import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import './index.css';
import App from './App.jsx';

createRoot(document.getElementById('root')).render(
  <StrictMode>
    <App />
  </StrictMode>
);

How It Works

  • createRoot(document.getElementById('root')) — finds the empty div in index.html and tells React to take control of it.
  • .render(<App />) — puts your App component inside that div.
  • <StrictMode> — a development-only wrapper that warns you about unsafe patterns. It does not appear in the final build. It also intentionally runs some code twice in development, which surprises beginners later in the useEffect lesson.

This is why React apps are called single-page applications: there is only one real HTML file, and React swaps the contents.


ReactJS Tutorial

VA

Vishalini A



Learn via Video Course

React.js for Beginners: Build Modern Web Applications with React Logo

React.js for Beginners: Build Modern Web Applications with React

6 hrs



Get in Touch For Details