Code Room
Code reviewHard
Question
Review this React TypeScript toggle-in-list updater.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
function Layers({ initial }: { initial: Layer[] }) { const [layers, setLayers] = useState(initial); const toggle = (id: string) => { setLayers(layers.map((l) => { if (l.id === id) l.visible = !l.visible; return l; })); }; return <Panel layers={layers} onToggle={toggle} />;}Run or narrate your approach, then ask the coach.