{
  "id": 5710718,
  "title": "useEffect Fired Twice and It Found a Real Bug",
  "url": "https://urgent.news/2026/09/05/useeffect-fired-twice-and-it-found-a-real-bug",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-05T03:34:36.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/rbonweb/useeffect-fired-twice-and-it-found-a-real-bug-5438"
  },
  "original_language": "en",
  "account": "useEffect fired twice in development mode, every single time. This issue was first attributed to a bug, but the true cause was React 18's Strict Mode. The Strict Mode deliberately mounts, unmounts, and remounts every component once to surface effects that aren't properly cleaned up. In production, this double invocation doesn't occur. The fix involved ensuring the effect was idempotent or explicitly guarded to handle the double mount correctly. This bug was caught by Strict Mode, preventing duplicate records from appearing in the table.",
  "summary": "useEffect fired twice, on mount, every single time, in development only. The API call inside it — a POST that created a resource — ran twice, and for about a day we had duplicate records showing up in a table that should have had exactly one insert per page load. The first reaction, and why it was wrong The instinct is to assume a bug — a rerender loop, a missing dependency, something actually…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}