TGViewer
Web Development Web Development @webdevcoursefree · 79.6K subscribers
Post #3543 4.24K
Now, let's move to the next topic in Web Development Roadmap:

⚛️ JSX & React Project Structure

This topic explains how React writes UI code and how React apps are organized.

🧩 What is JSX ❓
JSX Meaning JSX = JavaScript XML
👉 Allows writing HTML inside JavaScript. Simple meaning
- HTML-like syntax inside JS
- Makes UI code easier to write

🧠 Why JSX Exists
Without JSX (pure JS) React.createElement("h1", null, "Hello");
With JSX (easy) <h1>Hello</h1>
✅ Cleaner ✅ Readable ✅ Faster development

✍️ Basic JSX Example
function App() {
return <h1>Hello React</h1>;
}

✔ Looks like HTML ✔ Actually converted to JavaScript

⚠️ JSX Rules (Very Important)
1. Return only one parent element
❌ Wrong return ( <h1>Hello</h1> <p>Welcome</p> );
✅ Correct return ( <div> <h1>Hello</h1> <p>Welcome</p> </div> );

2. Use className instead of class
<div className="box"></div>
Because class is reserved in JavaScript.

3. Close all tags
<img src="logo.png" />
<input />

4. JavaScript inside { }
const name = "Deepak";
return <h1>Hello {name}</h1>;

✔ Dynamic content rendering

🔄 JSX Expressions
You can use:
- Variables
- Functions
- Conditions
Example let age = 20;
return <p>{age >= 18 ? "Adult" : "Minor"}</p>;

📁 React Project Structure
When you create a React app, files follow a structure.

🗂️ Typical React Folder Structure
my-app/
├── node_modules/
├── public/
├── src/
│ ├── App.js
│ ├── index.js
│ ├── components/
│ └── styles/
├── package.json

📦 Important Folders Explained
📁 public/
- Static files
- index.html
- Images
- Favicon
Browser loads this first.

📁 src/ (Most Important)
- Main application code
- Components
- Styles
- Logic
You work here daily.

📄 App.js
- Main component
- Controls UI structure
- Parent of all components

📄 index.js
- Entry point of app
- Renders App into DOM
Example idea ReactDOM.render(<App />, document.getElementById("root"));

📄 package.json
- Project dependencies
- Scripts
- Version info

🧠 How React App Runs (Flow)
1️⃣ index.html loads
2️⃣ index.js runs
3️⃣ App component renders
4️⃣ UI appears

⚠️ Common Beginner Mistakes
- Multiple parent elements in JSX
- Using class instead of className
- Forgetting to close tags
- Editing files outside src

🧪 Mini Practice Task
- Create JSX heading showing your name
- Use variable inside JSX
- Create simple component folder structure
- Create a new component and use inside App


✅ Mini Practice Task – Solution ⚛️

🟦 1️⃣ Create JSX heading showing your name
👉 Inside App.js
function App() {
return <h1>My name is Deepak</h1>;
}
export default App;

✔ JSX looks like HTML
✔ React renders heading on screen

🔤 2️⃣ Use variable inside JSX
👉 JavaScript values go inside { }
function App() {
const name = "Deepak";
return <h1>Hello {name}</h1>;
}
export default App;

✔ Dynamic content rendering
✔ React updates if value changes

📁 3️⃣ Create simple component folder structure
Inside src/ folder create:
src/
├── App.js
├── index.js
└── components/
└── Header.js

✔ components/ keeps reusable UI code
✔ Better project organization

🧩 4️⃣ Create new component and use inside App
✅ Step 1: Create Header.js inside components/
function Header() {
return <h2>Welcome to My Website</h2>;
}
export default Header;

✅ Step 2: Use component in App.js
import Header from "./components/Header";

function App() {
return (
<div>
<Header />
<h1>Hello React</h1>
</div>
);
}
export default App;

✔ Component reused
✔ Clean UI structure

🧠 What you learned
✅ Writing JSX
✅ Using variables inside JSX
✅ Organizing React project
✅ Creating reusable components

Double Tap ♥️ For More
  • ❤ 21
  • 👍 2
  • 🔥 1
More from @webdevcoursefree
  1. Oct 14, 2026🌐 Web Development Roadmap — Part 17 HTML Images — <img> Tag Images make webpages more vis…
  2. Oct 13, 2026𝗧𝗢𝗣 𝗙𝗥𝗘𝗘 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝗧𝗢 𝗕𝗢𝗢𝗦𝗧 𝗬𝗢𝗨𝗥 𝗦𝗞𝗜𝗟𝗟𝗦 𝗜𝗡 𝟮𝟬𝟮𝟲! Explor…
  3. Oct 12, 2026For example: Go to Profile → <a> Submit Form → <button> Open Article → <a> Delete Account…
  4. Oct 12, 2026🌐 Web Development Roadmap — Part 16 HTML Links — Tag Links are one of the most important…
  5. Oct 12, 2026🚀 𝗪𝗵𝗶𝗰𝗵 𝗧𝗲𝗰𝗵 𝗦𝗸𝗶𝗹𝗹 𝗪𝗶𝗹𝗹 𝗬𝗼𝘂 𝗠𝗮𝘀𝘁𝗲𝗿 𝗶𝗻 𝟮𝟬𝟮𝟲? Want to buil…
  6. Oct 9, 2026Post #4079
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →