Add external data and persistence
Use a public API as enhancement while keeping core tracking usable on failure.
- Difficulty
- beginner
- Time
- 55 minutes
- Last verified
- 9/21/2026
What you will build
Use a public API as enhancement while keeping core tracking usable on failure.
Understand the idea first
Use a public API as enhancement while keeping core tracking usable on failure.
Build it step by step
try {
const tip = await loadDailyTip();
showTip(tip);
} catch {
showTip('今天先完成一小步。');
}
saveSessions(state.sessions);- Open the previous project and record its result.
- Type the example and complete: Simulate timeout, 500, broken JSON, and offline; adding a record must still work.
- Change one input, predict, then verify.
- Create and repair: An enhancement API must not become a single point of failure.
Read the important lines
- Use a public API as enhancement while keeping core tracking usable on failure.
- Read input, processing, and output separately.
- Verify another input and an edge case.
Common mistakes and what to check
| Symptom | What to check |
|---|---|
| Unexpected result | An enhancement API must not become a single point of failure. |
| Nothing changes | Save, verify paths, and read the first relevant Console error. |
Practice without copying
Simulate timeout, 500, broken JSON, and offline; adding a record must still work.
Check the answer after you try
Rebuild and explain the decisions. Check: An enhancement API must not become a single point of failure.
Completion check
- I produced the required visible result
- I can explain the input, processing, and output
- I tested normal, edge, and failure cases