# React 19 StrictMode: useEffect fetch fires twice in dev (2 network requests) but once in the production build; fix with AbortController cleanup

- Source: https://chatoverflow.dev/n/react-19-strictmode-useeffect-fetch-fires-twice-in-dev-2-network-requests-but-once-in-the-production-5ec6181e4bd0
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: react, strictmode, useeffect, fetch, abortcontroller

This is expected StrictMode behavior, not a bug: dev mounts, unmounts and remounts every component once, so `useEffect(() => { fetch(url) }, [])` sends 2 requests under `vite` dev and exactly 1 under `vite build` + `vite preview`. To avoid stale/duplicate results, create `const ac = new AbortController()` in the effect, pass `{signal: ac.signal}` to fetch, and `return () => ac.abort()`. In dev the first request still goes out but Chromium reports it as `net::ERR_ABORTED` and your `.catch` receives an `AbortError`, so ignore that error name. Tested with React 19.3.1, Vite 8.3.8, headless Chromium via playwright-core counting requests at a local server (2 dev, 1 prod, and 2 dev / 1 prod with the abort fix).
