Thuta Learning
React
BasicWeb DevelopmentIntermediate

React Home: How This Course Works

ReactLesson 115 min

What you'll walk away with

  • Explain in your own words that React is a library for describing UI from data
  • Name the three core ideas you will meet first: components, props and state
  • Know what each of the five chapters (Basic to Exercises) covers and plan your study
  • Read a function component and predict what it renders

Explain it simply

Explain it simply

React is a JavaScript library for building user interfaces. Instead of giving the browser step-by-step orders about how to change the page, you describe what the screen should look like for the data you have. When that data changes, React updates the page in the browser for you.

You build a React app from small pieces called components, a bit like Lego bricks. A button, a course card, a navigation bar: each one is a small JavaScript function that returns JSX, a markup syntax that looks like HTML. Snap the bricks together and you get a whole page.

Problem → Why → Solution

The problem: updating every spot on the page by hand

Imagine an online shop that shows the cart count in a header badge, in a sidebar and on the checkout button. With plain JavaScript, every click on "Add" means finding all three spots with document.querySelector and editing them yourself. A month later someone adds a "Remove" button, forgets one of the spots, and now the badge says 3 while checkout says 2.

cart.js
let count = 0;

function addItem() {
  count = count + 1;
  document.querySelector("#badge").textContent = count;
  document.querySelector("#sidebar-count").textContent = count;
  document.querySelector("#checkout").textContent = "Checkout (" + count + ")";
}

function removeItem() {
  count = count - 1;
  document.querySelector("#badge").textContent = count;
  // forgot #sidebar-count and #checkout: the page now disagrees with itself
}

Why does this bug happen?

The only thing connecting the data (count) to the screen is the developer's memory: every place that changes the data must also remember to patch the DOM. In React you describe once how the UI looks for a given count, and when count changes React redraws the screen, so there is no spot left to forget.

Core concept: React's three big ideas and the shape of this course

Three ideas come back in every React lesson. The first is the component: a function that returns JSX and whose name starts with a capital letter. The second is props: data a parent component hands down to a child, much like arguments to a function. The third is state: data a component remembers itself and that can change over time; every change makes React render the component again.

Put together they give React's core formula: the UI is a function of the data. Data goes in, the component returns JSX, and React adjusts the browser DOM to match that JSX.

React is not a full framework; it is a library that handles the UI layer. For moving between pages (routing) or loading data from a server, people pair it with libraries such as React Router or with frameworks such as Next.js. This course is based on React 19 and uses only function components and hooks. Older tutorials online still show class components, but new code no longer uses them.

ChapterWhat you learn
Basic (11 lessons)Vite setup, JSX, components, props, state, events, conditional rendering, lists and keys, forms
Intermediate (6 lessons)useEffect, useContext, useReducer, refs, custom hooks, effect events
Advanced (11 lessons)React Router, Suspense, data fetching, Actions, styling, testing, performance, production architecture
Projects (3 lessons)Build a Task Tracker app step by step, from setup to polish
Exercises (2 lessons)Practice sets that re-test the core concepts and hooks with data

Every lesson has the same shape: a plain explanation, a real problem, the core concept, an example with a line-by-line breakdown, common mistakes, a mini challenge and three quiz questions. Knowing basic HTML, CSS and JavaScript (arrow functions, destructuring, array.map, import/export) makes the course faster. Try each challenge yourself before opening the solution; that is the quickest route to really understanding React.

Mental model: UI is a function of data
  1. Data exists (props or state)
  2. The component returns JSX
  3. React makes the DOM match the JSX
  4. Data changes, the cycle repeats

You never patch the DOM yourself; you change the data and let React do the rest.

General pattern: a function component

ComponentName.jsx
function ComponentName() {
  const value = "some data";

  return (
    <tag>
      Text and {value} inside curly braces
    </tag>
  );
}

export default ComponentName;

A component is a function whose name starts with a capital letter. Its return statement holds JSX wrapped in parentheses, and anything inside { } is a JavaScript expression. export default lets other files import it.

Example: a first component that welcomes you to the course

This component keeps the learner's name and the course chapters as data, and describes a heading, a summary line and a numbered list from that data. After the setup lesson you can paste it into src/App.jsx and run it. For now, read it and predict what it renders.

CourseWelcome.jsx
function CourseWelcome() {
  const learner = "Su Su";
  const chapters = ["Basic", "Intermediate", "Advanced", "Projects", "Exercises"];
  const totalLessons = 33;

  return (
    <main>
      <h1>Welcome to React, {learner}!</h1>
      <p>
        {chapters.length} chapters, {totalLessons} lessons.
      </p>
      <ol>
        {chapters.map((chapter) => (
          <li key={chapter}>{chapter}</li>
        ))}
      </ol>
    </main>
  );
}

export default CourseWelcome;

Code breakdown

  1. Line 1function CourseWelcome() {

    A component is an ordinary JavaScript function. Its name starts with a capital C, so when you write <CourseWelcome />, React knows it is your component and not an HTML tag.

  2. Lines 2-4const chapters = ["Basic", "Intermediate", "Advanced", "Projects", "Exercises"];

    The data the UI shows is declared as plain variables. In later lessons this data will come from props or state instead.

  3. Line 8<h1>Welcome to React, {learner}!</h1>

    The curly braces in {learner} are a window back into JavaScript. When the component renders, "Su Su" is placed there.

  4. Line 10{chapters.length} chapters, {totalLessons} lessons.

    Braces accept any expression, not just a variable name, so chapters.length works and its result, 5, appears as text.

  5. Lines 13-15{chapters.map((chapter) => (

    array.map() turns each chapter into its own <li>. The key={chapter} helps React tell the items apart; the Lists and Keys lesson explains it in detail.

You should see
The browser shows the heading "Welcome to React, Su Su!", the line "5 chapters, 33 lessons.", and a numbered list: 1. Basic, 2. Intermediate, 3. Advanced, 4. Projects, 5. Exercises.

How a component reaches the browser

Browsers cannot read JSX directly. During development a build tool such as Vite turns JSX into plain JavaScript function calls. When the browser runs that JavaScript, the react-dom package calls your components and, following the description they return, creates real HTML elements inside the root div of index.html. The next two lessons walk through each of these steps hands-on.

text
From a .jsx file to pixels
--------------------------
App.jsx (JSX)
     |
     v   Vite compiles JSX -> plain JavaScript
main.js in the browser
     |
     v   react-dom calls App() and reads the result
<div id="root"> ... real DOM elements ... </div>
     |
     v   data changes -> App() runs again -> only the
         differences are written to the DOM

In real projects

Where React shows up in real projects

React is most common in interfaces whose data changes often: dashboards, admin panels, e-commerce sites and chat apps. Writing a product card component once and reusing it for hundreds of products, or keeping the cart count in one piece of state that both the header and the checkout read, are exactly the patterns this course teaches.

In larger teams, components grow into a design system: Button, Modal and Card live in one shared library that every product team reuses. With React Native the same ideas of components, props and state also build mobile apps, so what you learn here is not limited to the web. When a job posting asks for React experience, it mostly means the skills in these five chapters.

Common mistakes

Common mistakes when starting out

1. Starting React before the JavaScript basics are solid

Most React code is really plain JavaScript: destructuring, arrow functions, array.map() and spread (...). If those feel unfamiliar, React seems confusing, but the actual gap is JavaScript. When a piece of syntax puzzles you, first decide whether it is a React feature or a JavaScript one.

2. Copying code from outdated tutorials

Plenty of old articles still use class components, create-react-app and ReactDOM.render(). ReactDOM.render() was removed in React 19, so copied code fails, and Create React App is deprecated. Prefer sources that use createRoot(), Vite and function components.

3. Reading examples without running them

Reading an example feels like understanding it, but it only sticks once you edit and run it yourself. Change a value, delete a tag, and watch what happens.

Best practices

How to get the most out of this course

  • Work through the Basic chapter in order, because every later lesson builds on JSX, props and state.
  • Keep one Vite project open while you study and paste each example into src/App.jsx to modify it.
  • When a quiz answer is wrong, read the explanation and revisit that section instead of memorising the answer.
  • In the Projects chapter, attempt each feature on your own before reading the lesson that builds it.

Mini challenge

Mini challenge: your learner badge

Write a LearnerBadge component that describes you. Keep the data in variables and show it in the JSX with curly braces.

  • Declare four variables: name, goal, known (an array) and weeks (a number)
  • Show name inside an <h2>
  • Compute weeks * 3 to show the total study hours
  • Show the known array as one line with join(", ")
LearnerBadge.jsx
function LearnerBadge() {
  // TODO: declare name, goal, known (array of skills) and weeks

  return (
    <section className="badge">
      {/* TODO: name in an <h2> */}
      {/* TODO: "Goal: ..." */}
      {/* TODO: "Plan: X weeks, about Y hours" (3 hours per week) */}
      {/* TODO: "Already know: ..." using join */}
    </section>
  );
}

export default LearnerBadge;

Expected: With the solution's data you see the heading "Ko Zaw", then "Goal: build a task tracker", "Plan: 6 weeks, about 18 hours" and "Already know: HTML, CSS, JavaScript".

Show hint

Any expression works inside braces: both {weeks * 3} and {known.join(", ")} are fine. JSX comments are written as {/* ... */}.

Show solution
LearnerBadge.jsx
function LearnerBadge() {
  const name = "Ko Zaw";
  const goal = "build a task tracker";
  const known = ["HTML", "CSS", "JavaScript"];
  const weeks = 6;

  return (
    <section className="badge">
      <h2>{name}</h2>
      <p>Goal: {goal}</p>
      <p>Plan: {weeks} weeks, about {weeks * 3} hours</p>
      <p>Already know: {known.join(", ")}</p>
    </section>
  );
}

export default LearnerBadge;

Quick quiz 1 / 3

Which sentence best describes React?

Quick quiz 2 / 3

With const chapters = ["Basic", "Intermediate", "Advanced"];, what does <p>{chapters.length} chapters</p> show?

Quick quiz 3 / 3

How does this course write components?

What to remember

  • React is a JavaScript library that describes UI from data: you change the data, not the DOM.
  • Components (functions returning JSX), props (data from a parent) and state (data that changes) are the three core ideas.
  • The course has five chapters and 33 lessons: Basic, Intermediate, Advanced, Projects and Exercises.
  • Use React 19 with function components and hooks; avoid class components and ReactDOM.render() from old tutorials.

React Versions — React

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

React Home: How This Course Works | Thuta Learning