1️⃣ What Is React.js and Why Should You Learn It?
React.js is a JavaScript library created by Facebook for building fast, interactive user interfaces (UI), especially for Single Page Applications (SPA). Instead of reloading the whole page every time, React updates only the parts of the screen that need to change.
If you want to become a modern Frontend or Full Stack Developer, React is one of the best skills you can learn. It’s used by companies like Facebook, Instagram, Netflix, Uber, Airbnb and thousands of others.
- ⚡ Fast UI updates using a Virtual DOM
- 🧩 Reusable components (write once, use everywhere)
- 🌍 Huge ecosystem and community
- 💼 High demand in the job market
2️⃣ Prerequisites Before Starting React
Before jumping into React, make sure you are comfortable with:
- ✅ HTML: Elements, attributes, forms, basic structure
- ✅ CSS: Layout, flexbox, basic responsive design
- ✅ JavaScript:
let/const, functions, arrays, objects,map,filter,forEach - ✅ ES6: Arrow functions, template literals, destructuring, import/export
- ✅ Basic CLI: Using terminal / command prompt
3️⃣ How React Works – The Core Ideas
React is built around a few simple but powerful ideas:
- Components – Your UI is broken into small, reusable pieces.
- JSX – You write HTML-like syntax inside JavaScript.
- Props – Data you pass into components.
- State – Data that can change over time (and re-renders the UI).
- Hooks – Functions like
useStateanduseEffectthat add power to functional components.
🔹 Components
A component is just a JavaScript function that returns JSX (UI).
function Welcome() {
return <h1>Hello, React!</h1>;
}
🔹 JSX
JSX looks like HTML but is actually JavaScript syntax. You can embed variables and expressions inside:
const name = "Sajid";
function Welcome() {
return <h1>Welcome, {name}!</h1>;
}
🔹 Props (Component Inputs)
Props are used to pass data from parent to child components:
function Welcome(props) {
return <h1>Hello, {props.name}!</h1>;
}
// Usage:
<Welcome name="Rabby" />
🔹 State (Dynamic Data)
State is data that can change over time inside a component. When state changes, React re-renders that part of the UI.
import { useState } from "react";
function Counter() {
const [count, setCount] = useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click me
</button>
</div>
);
}
4️⃣ Setting Up Your First React Project
There are many ways to start a React project. Today, Vite is one of the fastest and simplest ways.
Option 1 – Using Vite (Recommended)
- Install Node.js (LTS version) from the official website.
- Open your terminal / CMD.
- Run these commands:
npm create vite@latest my-react-app -- --template react
cd my-react-app
npm install
npm run dev
Then open the URL shown in the terminal (usually http://localhost:5173).
Project Structure (Common Files)
src/main.jsx– Entry point where React is rendered.src/App.jsx– Main app component.src/assets– Images, icons, etc.package.json– Project dependencies and scripts.
5️⃣ Thinking in Components – A Simple Example
Let’s say you want to build a small “Skills” section for your portfolio. You can break it into:
- App – Main wrapper.
- SkillList – Shows a list of skills.
- SkillItem – A single skill card.
// SkillItem.jsx
function SkillItem({ name, level }) {
return (
<li>
<strong>{name}</strong> – {level}
</li>
);
}
export default SkillItem;
// SkillList.jsx
import SkillItem from "./SkillItem";
function SkillList() {
const skills = [
{ name: "HTML", level: "Strong" },
{ name: "CSS", level: "Good" },
{ name: "React", level: "Learning" },
];
return (
<ul>
{skills.map((skill) => (
<SkillItem
key={skill.name}
name={skill.name}
level={skill.level}
/>
))}
</ul>
);
}
export default SkillList;
// App.jsx
import SkillList from "./SkillList";
function App() {
return (
<div>
<h1>My Skills</h1>
<SkillList />
</div>
);
}
export default App;
6️⃣ React Hooks – The Essentials for Beginners
Hooks let you “hook into” React features from function components. As a beginner, focus on these two:
✔ useState – Manage Local State
You already saw useState in the counter example. Use it for:
- Input values (form fields)
- Toggle states (open/close, dark/light)
- Simple counters, filters
✔ useEffect – Side Effects
useEffect runs code when something changes (or when the component loads).
For example, fetching data from an API:
import { useEffect, useState } from "react";
function Users() {
const [users, setUsers] = useState([]);
useEffect(() => {
fetch("https://jsonplaceholder.typicode.com/users")
.then((res) => res.json())
.then((data) => setUsers(data));
}, []); // empty array = run once
return (
<ul>
{users.map(user => <li key={user.id}>{user.name}</li>)}
</ul>
);
}
7️⃣ Common Beginner Mistakes (and How to Avoid Them)
- ❌ Trying to learn React without JavaScript basics → ✅ Fix: Spend time on JS first.
- ❌ Copy-pasting code without understanding → ✅ Fix: Rewrite code in your own words.
- ❌ Putting everything in one giant component → ✅ Fix: Split UI into small reusable components.
- ❌ Not using
keywhen rendering lists → ✅ Fix: Always add a uniquekeyprop. - ❌ Mixing too much logic inside JSX → ✅ Fix: Prepare data above, then render clean JSX.
8️⃣ Simple Practice Roadmap (30 Days)
Here’s a simple 4-week plan you can follow:
- Week 1: Basics – components, JSX, props,
useState(build small UI pieces) - Week 2: Lists, conditional rendering, handling events (to-do list, counter, filters)
- Week 3:
useEffect, API calls (simple dashboards using free APIs) - Week 4: Small project – a portfolio, notes app, or simple blog frontend
9️⃣ What to Learn After React Basics
Once you are comfortable with React fundamentals, you can explore:
- 📦 State management: Context API, Redux, Zustand, etc.
- 🧭 Routing:
react-router-domfor multiple pages - 🎨 UI frameworks: Tailwind CSS, MUI, Chakra UI
- ⚙ Backend: Node.js, Express, MongoDB (for full stack)
- 🚀 Next.js: Framework for server-side rendering & full stack apps
✅ Final Thoughts
React is not something you “understand in one weekend”. But with consistent practice, small projects, and patience, it becomes enjoyable and powerful.
If you already know HTML, CSS, and JavaScript, React is your next big step towards becoming a serious Frontend or Full Stack Developer.
Start small, keep building, and don’t be afraid to break things while learning.