Skip to content

Commit 95f8025

Browse files
shamishamiclaude
andcommitted
Rebuild lab6 as Vite + React 19 project with self-contained ans/
- Upgrade to latest: React 19.2.4, Vite 8.0.1, @vitejs/plugin-react 6.0.1 - Both exercise/ and ans/ are fully independent Vite projects (each has package.json, package-lock.json, vite.config.js, index.html, src/) - ans/ is immediately runnable: npm ci && npm run dev - exercise/ has 5 TODOs in src/App.jsx (components, props, useState, onClick) - Add .gitignore to exclude node_modules and dist Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a4e487e commit 95f8025

18 files changed

Lines changed: 2140 additions & 208 deletions

PLAN.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,18 @@ lab5/ ← Deploy
197197
│ └── script.js (2 TODOs — your name + university year)
198198
└── GUIDE.md (step-by-step GitHub Pages deployment)
199199
200-
lab6/ ← React Introduction
200+
lab6/ ← React Introduction (Vite project)
201201
├── exercise/
202-
│ ├── index.html (pre-provided — CDN React + Babel setup)
203-
│ ├── style.css (pre-provided — card & badge styles)
204-
│ └── App.js (5 TODOs — components, props, useState, onClick)
202+
│ ├── package.json (pre-provided — React 18 + Vite)
203+
│ ├── vite.config.js (pre-provided)
204+
│ ├── index.html (pre-provided)
205+
│ └── src/
206+
│ ├── main.jsx (pre-provided — entry point)
207+
│ ├── App.jsx (5 TODOs — components, props, useState, onClick)
208+
│ └── App.css (pre-provided — card & badge styles)
205209
└── ans/
206-
├── index.html
207-
├── style.css
208-
└── App.js (completed example)
210+
└── src/
211+
└── App.jsx (completed example)
209212
```
210213

211214
| Lab | File to edit | TODOs | Concepts |
@@ -215,7 +218,7 @@ lab6/ ← React Introduction
215218
| lab3 | `exercise/script.js` | 5 core + 2 bonus | Variables, functions, DOM manipulation |
216219
| lab4 | `exercise/style.css` + `script.js` | 6 core + 2 bonus | Dark mode toggle, classList, localStorage |
217220
| lab5 | `exercise/index.html` + `script.js` | 10 | Personalize content, then deploy |
218-
| lab6 | `exercise/App.js` | 5 | React components, props, useState, onClick |
221+
| lab6 | `exercise/src/App.jsx` | 5 | React components, props, useState, onClick |
219222

220223
Each lab builds on the previous one. Each TODO requires at most one line — just fill and save, and Live Server updates instantly.
221224

lab6/ans/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

lab6/ans/index.html

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
<!DOCTYPE html>
2-
<!-- ANSWER KEY — Lab 6 -->
2+
<!--
3+
Lab 6 — pre-provided, no changes needed here.
4+
React will inject everything into <div id="root"> below.
5+
6+
To run this project:
7+
1. Open a terminal in this folder (lab6/exercise)
8+
2. npm install ← downloads React and Vite
9+
3. npm run dev ← starts the dev server
10+
4. Open http://localhost:5173 in your browser
11+
5. Edit src/App.jsx and fill in the TODOs — the browser updates instantly!
12+
-->
313
<html lang="zh-Hant">
4-
<head>
5-
<meta charset="UTF-8">
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>Lab 6 — My First React App</title>
8-
<script src="https://unpkg.com/react@18/umd/react.development.js"></script>
9-
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
10-
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
11-
<link rel="stylesheet" href="style.css">
12-
</head>
13-
<body>
14-
<div id="root"></div>
15-
<script type="text/babel" src="App.js"></script>
16-
</body>
14+
<head>
15+
<meta charset="UTF-8" />
16+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
17+
<title>Lab 6 — My First React App</title>
18+
</head>
19+
<body>
20+
<div id="root"></div>
21+
<script type="module" src="/src/main.jsx"></script>
22+
</body>
1723
</html>

0 commit comments

Comments
 (0)