Code Room
Code reviewHard
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.
Learn the concepts
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.