Code Room
Code reviewHardcr-g399
Subject Race conditions in fetchLevel Mid–Senior~20 minCommon in Concurrency interviewsIndustries Software development

Question

Review this React TypeScript tab content loader.

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.

Talk through your review
Code to reviewtsx
function TabContent({ tab }: { tab: string }) {  const [body, setBody] = useState('');   useEffect(() => {    let active = true;    fetch(`/api/tabs/${tab}`)      .then((r) => r.text())      .then((t) => setBody(t));    return () => { active = false; };  }, [tab]);   return <div>{body}</div>;}
Run or narrate your approach, then ask the coach.