Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
[Compiler Bug]: react-hooks/exhaustive-deps conflicts with idea of React compiler in terms of functions memoization | GoodFirstPicks

[Compiler Bug]: react-hooks/exhaustive-deps conflicts with idea of React compiler in terms of functions memoization

facebook/react 4 comments 1mo ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeReactJavaScriptTypeScript

Why this is a good first issue

Conflict between compiler memoization and eslint rules needs resolution.

AI Summary

The issue describes a conflict between React Compiler's automatic memoization and eslint-plugin-react-hooks' dependency checks. The solution likely involves modifying the eslint plugin to detect compiler usage and adjust its behavior. The main challenge is understanding both systems' internals and coordinating changes.

Issue Description

What kind of issue is this?

  • React Compiler core (the JS output is incorrect, or your app works incorrectly after optimization)
  • babel-plugin-react-compiler (build issue installing or using the Babel plugin)
  • eslint-plugin-react-hooks (build issue installing or using the eslint plugin)
  • react-compiler-healthcheck (build issue installing or using the healthcheck script)

Link to repro

https://github.com/kaguya3222/react-compiler-exhaustive-deps-repro

Repro steps

  1. Clone the repo
  2. pnpm install
  3. pnpm lint
  4. Explore the linting error
error  The 'logCount' function makes the dependencies of useEffect Hook (at line 22) change on every render. To fix this, wrap the definition of 'logCount' in its own useCallback() Hook  react-hooks/exhaustive-deps

App.tsx file has a component named App. In this component we have a function logCount, used in useEffect. react-hooks/exhaustive-deps says: React Hook useEffect has a missing dependency: 'logCount'. Either include it or remove the dependency array.. After adding it to dependency array it says: The 'logCount' function makes the dependencies of useEffect Hook (at line 22) change on every render. To fix this, wrap the definition of 'logCount' in its own useCallback() Hook.

The problem is that I don't need to wrap this function into a useCallback, because compiler will do it for me. Disabling eslint at the line of logCount definition is an option, but I don't think it's a good approach in the long term.

How often does this bug happen?

Every time

What version of React are you using?

19.2.0

What version of React Compiler are you using?

1.0.0

GitHub Labels

Type: BugStatus: Unconfirmed

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

  • requires understanding of both React Compiler and eslint-plugin-react-hooks internals
  • potential need for coordination between different teams
Loading labels...

Details

Points10 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno