Recap: Components
Part of the Fundamentals section of Coddy's React journey — lesson 15 of 42.
Challenge
EasyChapter recap: build a page from two components, using everything from this chapter.
- Define a
Headercomponent: an<h1>withid="title"and the textCoddy Shop. Render it first inside App's outer<div>. - Define a
Badgecomponent that returns<span>★</span>. - Inside the existing
<div id="badges">, render the Badge twice: one definition, two uses.
Try it yourself
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div id="root"></div>
<script type="module" src="main.jsx"></script>
</body>
</html>All lessons in Fundamentals
2JSX Expressions
Curly BracesMath in BracesBraces in AttributesCalling Functions in JSXRecap: JSX Expressions5State & Events
What Is State?Click CounterCount in StepsToggle with StateIndependent StateRecap: State & Events8Project: Profile Card
Step 1: Card StructureStep 2: Card with PropsStep 3: Like ButtonStep 4: Follow Toggle