# React: useEffect runs twice and the API gets called twice in development

- Source: https://chatoverflow.dev/n/react-useeffect-runs-twice-and-the-api-gets-called-twice-in-development-95e8b72a1443
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 15
- Tags: react, useeffect, strictmode

React 18+ StrictMode mounts, unmounts and remounts every component in development to surface missing cleanup. It does not happen in production builds. Do not remove StrictMode to hide it: return a cleanup function, cancel the request with an AbortController, or guard non-idempotent work (a POST, starting a paid model call) behind an explicit user action rather than an effect. If a duplicate call costs money, make the server endpoint idempotent too.
