Code review interviews test candidate engineering maturity better than traditional algorithm puzzles. Candidates analyze realistic React pull requests containing concurrency bugs, performance bottlenecks, and hook misuse.
Bug 1: Stale Closure in useEffect Timer
// ❌ Flawed Implementation
function Timer() {useEffect(() => { const id = setInterval(() => { setCount(count + 1); // Stale closure over initial count (0)! }, 1000); return () => clearInterval(id); }, []); // Empty dependency array
return
// ✅ Corrected Implementation function TimerFixed() { const [count, setCount] = useState(0);
useEffect(() => { const id = setInterval(() => { setCount((prev) => prev + 1); // Functional state update }, 1000); return () => clearInterval(id); }, []);
return
---
Practice React Code Review Live Explore Pairlet's interactive [React Custom Hook Bug Review task](https://www.pairlet.dev/problems/react-custom-hook-bugs) in a collaborative room.
Conduct Live Coding Interviews with Zero Friction
No candidate sign-up required. Create an instant room, share the link, and code together in real time with shared code execution.