Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
`useEffect` no longer run twice in React strict mode | GoodFirstPicks

`useEffect` no longer run twice in React strict mode

vercel/next.js 6 comments 1mo ago
View on GitHub
highopenScope: somewhat clearSkill match: noNext.jsTypeScriptReact

Why this is a good first issue

This is a React-specific bug already reported, not a Next.js issue.

AI Summary

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.

Issue Description

Link to the code that reproduces this issue

https://github.com/chungweileong94/nextjs-strict-mode-useeffect-bug

To Reproduce

  1. Start the app in development mode
  2. Navigate the page

Current vs. Expected behavior

Expected:

  • The useEffect code should run twice in development mode, which should show some errors (or double "effect" logs) in the console

Current:

  • The useEffect code only run once.

Provide environment information

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

Which area(s) are affected? (Select all that apply)

Developer Experience

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

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.

GitHub Labels

bug

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!

Risk Flags

  • React 19 RC bug
  • hydration-specific behavior
Loading labels...

Details

Points10 pts
Difficultyhigh
Scopesomewhat clear
Skill Matchno
Test Focusedno