动手做Get your hands on it
练习跟着课文走 —— 每节课尾都有本课的练习。这一页是全部练习的总库,想集中刷题的时候来。 每个练习都写清了它来自哪一节,卡住了就回去看那一节。Practice follows the lessons — every lesson ends with the exercises for that lesson. This page is the whole library, for when you want to drill in one sitting. Each exercise names the lesson it came from, so you can go back when you stall.
已筛到你正在学的《React 考试》。想看全部就点上面的「全部」。Filtered to React exam — the course you are on. Use “All” above to see everything.
练习Exercises
筛出 12 个练习(共 148 个)。Showing 12 of 148.下面哪一行会在页面上显示这条笔记的标题内容?
Which line below shows the title of this note on the page?
Q1 的三个任务(Add / Delete / Edit)都要改动笔记列表。 这些逻辑主要写在哪个文件里?
All three tasks in Q1 (Add / Delete / Edit) change the note list. Which file holds most of that logic?
notes 里每条是 { id: number; title: string; content: string }, 用户可以删除任意一条。下面哪个是最合适的 key?
Each item in notes is { id: number; title: string; content: string }, and the user can delete any of them. Which of these is the best key?
下面哪一段会导致表格里一行都不出现(而且不报错)?
Which of these makes the table show no rows at all, without reporting an error?
假设要给 Notes Manager 加一个「显示当前有几条笔记」的文字。 这个数字应该怎么实现?
Say you have to add a line to Notes Manager that shows how many notes there are right now. How should that number be produced?
假设要加一个搜索框(在 NoteForm 上方,属于 NoteManager 的直接子元素), 输入关键词后表格只显示匹配的笔记。 搜索关键词这个 state 该放在哪?
Say you add a search box above NoteForm, as a direct child of NoteManager. Once a keyword is typed, the table shows only the notes that match. Where should the state holding that keyword go?
README 只说了「不得修改任何 data-testid」。 下面哪些改动也会让现有测试失败?(多选)
The README says only that no data-testid may be changed. Which of the changes below also break the existing tests? (more than one)
这题是多选。More than one answer is correct.
下面哪个 handleDelete 能让四个测试全部通过, 但明显违反题目要求?
Which handleDelete below makes all four tests pass while clearly breaking what the task asks for?
你写的 handleSubmitNote 是 setNotes((prev) => [...prev, submittedNote]), 但自己加的测试报「找不到 My Title」。 测试代码是 userEvent.click(btn); expect(list).toHaveTextContent("My Title")。 最可能的原因?
Your handleSubmitNote is setNotes((prev) => [...prev, submittedNote]), but the test you added reports that My Title cannot be found. The test code is userEvent.click(btn); expect(list).toHaveTextContent("My Title"). What is the most likely reason?
假设签名改成 runTasks(promises: Promise<T>[], limit: number), 调用方写 runTasks([task1(), task2(), task3()], 2)。 会发生什么?
Suppose the signature becomes runTasks(promises: Promise<T>[], limit: number) and the caller writes runTasks([task1(), task2(), task3()], 2). What happens?
有人写 return Promise.allSettled(tasks.map((t) => t()))。 它满足几条要求?
Someone writes return Promise.allSettled(tasks.map((t) => t())). How many of the requirements does it meet?