Skip to content

Checkpoint: A Course Page

The Course
•
20 min study

This checkpoint has no new ideas. It checks that you can use today's ideas without the lesson walking you through them. Close the earlier lessons, read the brief, and build it. Use the hints only when you've been stuck for a few minutes.

The brief

Build a page for this course from three components:

  • CourseHeader shows the course name, React Beginner, as a heading. Under it, a line reads 7 days, about 630 minutes in total. Work out both numbers in JSX from two variables, days = 7 and 90 minutes a day. Don't type 630 yourself.
  • LessonList shows a heading Day 1 lessons and a numbered list of today's four lesson titles.
  • CourseFooter shows Next: Day 2, Props & Composition.

Each component lives in its own file in src/components/, with a default export. App imports all three and shows them in order.

Acceptance checks:

  • The page shows all three parts, in order, with no errors or warnings in the console.
  • Changing days to 5 changes the line to 5 days, about 450 minutes in total without any other edits.

Build it

The starter includes an almost empty App.jsx and three component files under src/components/. Each component currently returns null, which shows nothing. Open the folder tree, replace one placeholder at a time, and import each component into App.jsx. You can complete the whole brief in this browser. Download project saves your work for later; Day 7 explains local setup.

Your workspace React · 7 files
<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Course page</title> </head> <body> <div id="root"></div> <script type="module" src="/src/main.jsx"></script> </body> </html> import { createRoot } from "react-dom/client"; import App from "./App.jsx"; import "./styles.css"; const root = createRoot(document.getElementById("root")); root.render(<App />); // Build the course page here. // Put CourseHeader, LessonList and CourseFooter in src/components/, // then import them into this file. export default function App() { return ( <main> <p>Replace this paragraph with your components.</p> </main> ); } body { font: 16px/1.5 system-ui, sans-serif; margin: 0; color: #1c2430; } main { max-width: 32rem; margin: 1.5rem auto; padding: 0 1rem; } .header h1 { margin: 0; } .header p { margin: 0 0 1rem; color: #087ea4; } .card { border: 1px solid #d6dde6; border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 0.75rem; } .card h2 { margin: 0 0 0.25rem; font-size: 1.1rem; } // Build CourseFooter here. export default function CourseFooter() { return null; } // Build CourseHeader here. export default function CourseHeader() { return null; } // Build LessonList here. export default function LessonList() { return null; }
Runs with Vite on your computer: unzip, then npm install and npm run dev.
Hint 1: order of work

Get one component on the screen before writing the next. Write CourseHeader with plain text first, then replace the numbers with expressions in curly braces.

Hint 2: lists and the ampersand

A numbered list is <ol> with one <li> per item. To show & in JSX you can write it as is, or as &amp;. Both work.

Show one solution

Open src/components in this lab to see each file. Your text and styling can differ.

One solution React · 7 files
<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Course page</title> </head> <body> <div id="root"></div> <script type="module" src="/src/main.jsx"></script> </body> </html> import { createRoot } from "react-dom/client"; import App from "./App.jsx"; import "./styles.css"; const root = createRoot(document.getElementById("root")); root.render(<App />); import CourseHeader from "./components/CourseHeader.jsx"; import LessonList from "./components/LessonList.jsx"; import CourseFooter from "./components/CourseFooter.jsx"; export default function App() { return ( <main> <CourseHeader /> <LessonList /> <CourseFooter /> </main> ); } body { font: 16px/1.5 system-ui, sans-serif; margin: 0; color: #1c2430; } main { max-width: 32rem; margin: 1.5rem auto; padding: 0 1rem; } .header h1 { margin: 0; } .header p { margin: 0 0 1rem; color: #087ea4; } .card { border: 1px solid #d6dde6; border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 0.75rem; } .card h2 { margin: 0 0 0.25rem; font-size: 1.1rem; } export default function CourseFooter() { return ( <footer> <p>Next: Day 2, Props &amp; Composition</p> </footer> ); } const courseName = "React Beginner"; const days = 7; export default function CourseHeader() { return ( <header className="header"> <h1>{courseName}</h1> <p>{days} days, about {days * 90} minutes in total</p> </header> ); } export default function LessonList() { return ( <section className="card"> <h2>Day 1 lessons</h2> <ol> <li>Hello, React</li> <li>JSX</li> <li>Components</li> <li>Components in files</li> </ol> </section> ); }
Runs with Vite on your computer: unzip, then npm install and npm run dev.

Check yourself

Before Day 2, answer these from memory:

  1. What does root.render(<App />) do, and where does the page end up?
  2. Why does a component's name start with a capital letter?
  3. You see "Element type is invalid … got: undefined". What do you check first?

Was this article helpful?

Your response is saved on this device.