Dùng AbortController để cancel fetch request cũ khi effect re-run: const controller = new AbortController(); fetch(url, { signal: controller.signal }); return () => controller.abort().
- Hoặc dùng boolean flag
let cancelled = falsetrong cleanup. - React Query và SWR tự động handle race conditions.