TGViewer
Web Development - HTML, CSS & JavaScript Web Development - HTML, CSS & JavaScript @javascript_courses · 55.7K subscribers
Post #3338 4.13K
✅ React.js Essentials ⚛️🔥

React.js is a JavaScript library for building user interfaces, especially single-page apps. Created by Meta, it focuses on components, speed, and interactivity.

1️⃣ What is React?
React lets you build reusable UI components and update the DOM efficiently using a virtual DOM.

Why Use React?
• Reusable components
• Faster performance with virtual DOM
• Great for building SPAs (Single Page Applications)
• Strong community and ecosystem

2️⃣ Key Concepts

📦 Components – Reusable, independent pieces of UI.
function Welcome() {
return <h1>Hello, React!</h1>;
}

🧠 Props – Pass data to components
function Greet(props) {
return <h2>Hello, {props.name}!</h2>;
}
<Greet name="Riya" />

💡 State – Store and manage data in a component
import { useState } from 'react';

function Counter() {
const [count, setCount] = useState(0);
return (
<>
<p>Count: {count}</p>
<button onClick={() => setCount(count + 1)}>Add</button>
</>
);
}

3️⃣ Hooks

useState – Manage local state
useEffect – Run side effects (like API calls, DOM updates)
import { useEffect } from 'react';

useEffect(() => {
console.log("Component mounted");
}, []);

4️⃣ JSX
JSX lets you write HTML inside JS.
const element = <h1>Hello World</h1>;

5️⃣ Conditional Rendering
{isLoggedIn ? <Dashboard /> : <Login />}

6️⃣ Lists and Keys
const items = ["Apple", "Banana"];
items.map((item, index) => <li key={index}>{item}</li>);

7️⃣ Event Handling
<button onClick={handleClick}>Click Me</button>

8️⃣ Form Handling
<input value={name} onChange={(e) => setName(e.target.value)} />

9️⃣ React Router (Bonus)
To handle multiple pages
npm install react-router-dom

import { BrowserRouter, Route, Routes } from 'react-router-dom';


🛠 Practice Tasks
✅ Build a counter
✅ Make a TODO app using state
✅ Fetch and display API data
✅ Try routing between 2 pages

💬 Tap ❤️ for more
  • ❤ 12
  • 👌 1
More from @javascript_courses
  1. Oct 8, 2026🎓 𝗠𝗶𝗰𝗿𝗼𝘀𝗼𝗳𝘁 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 𝘄𝗶𝘁𝗵 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗲𝘀! 🚀🔥 Upgr…
  2. Oct 7, 2026🚀𝗣𝗮𝘆 𝗔𝗳𝘁𝗲𝗿 𝗣𝗹𝗮𝗰𝗲𝗺𝗲𝗻𝘁 𝗧𝗿𝗮𝗶𝗻𝗶𝗻𝗴 | 𝗕𝗲𝗰𝗼𝗺𝗲 𝗮 𝗙𝘂𝗹𝗹𝘀𝘁𝗮𝗰…
  3. Oct 7, 2026𝗠𝗮𝘀𝘁𝗲𝗿 𝗣𝗼𝘄𝗲𝗿 𝗕𝗜 𝗳𝗼𝗿 𝗙𝗥𝗘𝗘! 🔥 Learn Power BI through these FREE learnin…
  4. Oct 4, 2026DSA Handwritten Notes
  5. Sep 28, 2026To learn web design and development from basic to advanced levels, you can follow these st…
  6. Sep 27, 202610 Websites Every Developer & AI Enthusiast Should Bookmark ✅ roadmap.sh – Step-by-step le…
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 →