The Server Action That Ran Twice, but Only on localhost
Why a Next.js Server Action called from useEffect runs twice in development: React Strict Mode mounts every component twice. What that reveals, and where the call belongs.
4 min read
Why a Next.js Server Action called from useEffect runs twice in development: React Strict Mode mounts every component twice. What that reveals, and where the call belongs.
Why your effect reads old state, fires twice, or loops forever — and the simple rules to fix it (interview-ready).