Welcome to the React Basics practice repository! This module transforms you from a vanilla JavaScript developer into a React developer - you'll learn to build dynamic, component-based user interfaces using the most popular UI library.
React changes how you think about building web pages. Instead of manually selecting DOM elements and updating them, React lets you describe WHAT the UI should look like, and it handles the HOW. In this module, you'll master components, props, state, and hooks - the core building blocks of every React application.
| Topic | Description |
|---|---|
| JSX & Components | Creating reusable UI building blocks with JSX syntax |
| Props | Passing data between components for dynamic, reusable UIs |
| State (useState) | Managing interactive data that changes over time |
| Conditional Rendering | Showing/hiding UI and rendering dynamic lists with .map() |
| Forms & Refs | Handling user input, validation, and direct DOM access |
repo/
├── part-1/ ⭐ Very Basic - JSX & Components
│ ├── index.html
│ ├── script.js
│ └── README.md
│
├── part-2/ ⭐⭐ Basic - Props & Data Flow
│ ├── index.html
│ ├── script.js
│ └── README.md
│
├── part-3/ ⭐⭐⭐ Intermediate - State & Events
│ ├── index.html
│ ├── script.js
│ └── README.md
│
├── part-4/ ⭐⭐⭐⭐ Intermediate+ - Conditional Rendering & Lists
│ ├── index.html
│ ├── script.js
│ └── README.md
│
├── part-5/ ⭐⭐⭐⭐⭐ Advanced - Forms & Refs
│ ├── index.html
│ ├── script.js
│ └── README.md
│
├── part-6/ ⭐⭐⭐⭐⭐⭐ Advanced+ - Mini Project (Quiz App)
│ ├── index.html
│ ├── style.css
│ ├── script.js
│ └── README.md
│
├── homework/ 📝 Final Assignment (Todo App)
│ ├── index.html
│ ├── style.css
│ ├── script.js
│ └── README.md
│
└── README.md 📖 This file
- Basic HTML/CSS knowledge
- JavaScript fundamentals (variables, functions, arrays, objects)
- DOM manipulation knowledge (querySelector, addEventListener)
- ES6+ syntax (arrow functions, template literals, destructuring)
- A modern web browser (Chrome, Firefox, Edge)
- A code editor (VS Code recommended)
- Clone or download this repository to your computer
- Start with Part 1 - open the
part-1folder - Open
index.htmlin your browser to see the working examples - Open
script.jsin your code editor to study the code - Read through the examples and understand how each concept works
- Progress sequentially - each part builds on the previous
- Finish with Homework - practice exercises and the final project
- Navigate to any part folder (e.g.,
part-1/) - Double-click
index.htmlto open it in your browser (Chrome, Firefox, or Edge) - The page loads with working examples - interact with them
- Open
script.jsin your code editor (VS Code recommended) — this is a reference copy of the code - Study the code — the working code runs inline inside
index.html - To modify code, edit the
<script>block insideindex.html, then save (Ctrl+S) - Refresh the browser (Ctrl+R or Cmd+R) to see your changes
- Open Developer Tools (press F12) > Console tab to check for errors
No installation required. React loads automatically from the internet via CDN script tags. You only need a web browser and a text editor.
Difficulty: Very Basic
Learn React components and JSX syntax:
- Functional components
- JSX expressions with
{} classNamevsclass- Fragments and self-closing tags
Each part includes 1 working example and exercises to practice.
Difficulty: Basic
Learn props and data flow:
- Passing and destructuring props
- Different data types as props
- The
childrenprop - Component composition
Each part includes 1 working example and exercises to practice.
Difficulty: Intermediate
Learn useState and event handling:
- The
useStatehook - Click and input events
- Immutable state updates
- Controlled components
Each part includes 1 working example and exercises to practice.
Difficulty: Intermediate+
Learn conditional rendering and lists:
- Ternary and
&&rendering - Rendering lists with
.map() - The
keyprop - Filtering and sorting
Each part includes 1 working example and exercises to practice.
Difficulty: Advanced
Learn form handling, validation, and refs:
- Controlled vs uncontrolled components
- Form validation patterns
- The
useRefhook - Multi-step forms
Each part includes 1 working example and exercises to practice.
Difficulty: Advanced+
Build a complete Interactive Quiz Application combining all concepts!
Final Assignment
All practice exercises from the course, organized by part:
- Section 1: JSX & Components exercises (Part 1)
- Section 2: Props & Data Flow exercises (Part 2)
- Section 3: State & Events exercises (Part 3)
- Section 4: Conditional Rendering & Lists exercises (Part 4)
- Section 5: Forms & Refs exercises (Part 5)
- Section 6: Final Project — Todo App (combines everything)
- Type the code yourself - don't copy-paste
- Use console.log() - debug and understand what's happening
- Install React DevTools - browser extension for inspecting components
- Study all examples - then practice in the homework exercises
- Make mistakes - learning comes from debugging
| Problem | Solution |
|---|---|
| Nothing renders on screen | Check browser console for errors, verify CDN scripts load |
| Components not updating | Use setState, don't mutate state directly |
| Props are undefined | Check spelling of prop names, verify parent passes them |
| JSX errors | Remember: className not class, self-close <img />, single root element |
| Changes don't show | Save the file and refresh browser |
- Part 1: Studied JSX & Components examples
- Part 2: Studied Props & Data Flow examples
- Part 3: Studied State & Events examples
- Part 4: Studied Conditional Rendering & Lists examples
- Part 5: Studied Forms & Refs examples
- Part 6: Studied React Quiz App project
- Homework: Completed exercises and Todo App
Happy Coding!
Remember: React is just JavaScript. If you know JS, you already know half of React!