Code Room
Code reviewHard
Question
Review this React TypeScript component (Next.js App Router).
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 ThemeToggle() { const [theme, setTheme] = useState( typeof window !== 'undefined' ? localStorage.getItem('theme') ?? 'light' : 'light' ); return ( <button onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')} className={theme}> Toggle theme </button> );}Run or narrate your approach, then ask the coach.