Code RoomReact state mutation no re-render
MediumPrep Room Coding #4073

React state mutation no re-render

Vibe & agenticAlgorithms & data structuresMid–Senior~15 min

An AI generated this todo-toggle handler. Clicking a checkbox updates the data but the row's checkmark never re-renders. What's wrong?

Implement
toggle_todo_done(todo_lines: list[str], target_id: str) → list[str]
Examples
in[["t1:open","t2:done"],"t1"]out["t1:done","t2:done"]
in[["t1:open","t2:done"],"t2"]out["t1:open","t2:open"]
in[["t1:open"],"zz"]out["t1:open"]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 15 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.