This is a React-specific bug already reported, not a Next.js issue.
The issue describes a bug where `useEffect` does not run twice in React Strict Mode during hydration, contrary to expected behavior. This is a React-specific issue already reported, and it affects Next.js only indirectly. No action is required in Next.js as the bug resides in React itself.
https://github.com/chungweileong94/nextjs-strict-mode-useeffect-bug
Expected:
useEffect code should run twice in development mode, which should show some errors (or double "effect" logs) in the consoleCurrent:
useEffect code only run once.Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.5.0: Wed May 1 20:16:51 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8103
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 20.11.1
npm: 10.2.4
Yarn: 1.22.21
pnpm: 8.15.7
Relevant Packages:
next: 14.3.0-canary.81 // Latest available version is detected (14.3.0-canary.81).
eslint-config-next: N/A
react: 19.0.0-beta-04b058868c-20240508
react-dom: 19.0.0-beta-04b058868c-20240508
typescript: 5.1.3
Next.js Config:
output: N/A
Developer Experience
next dev (local)
I tested the other strict mode behavior (double re-rendering), and it seems to be working. However, the double useEffect doesn't seem to work as expected according to the React documentation.
Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!