Code Room
Code reviewHardcr-g400
Subject Race conditions in fetchLevel Senior–Staff~22 minCommon in Networking & APIs · Concurrency interviewsIndustries Software development

Question

Review this React TypeScript paginated appender.

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 Feed({ topic }: { topic: string }) {  const [items, setItems] = useState<Post[]>([]);  const [page, setPage] = useState(0);   const loadMore = async () => {    setPage((p) => p + 1);    const res = await fetch(`/api/feed?topic=${topic}&page=${page}`);    const data = await res.json();    setItems((prev) => [...prev, ...data.posts]);  };   return <List items={items} onEnd={loadMore} />;}
Run or narrate your approach, then ask the coach.