Code Room
Code reviewHard
Question
Review this React TypeScript keyboard-shortcut hook.
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 useUndoShortcut(history: string[], onUndo: () => void) { useEffect(() => { const onKey = (e: KeyboardEvent) => { if (e.key === 'z' && (e.metaKey || e.ctrlKey) && history.length > 0) { onUndo(); } }; window.addEventListener('keydown', onKey); return () => window.removeEventListener('keydown', onKey); }, []);}Run or narrate your approach, then ask the coach.