Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint react-hooks/exhaustive-deps error when using non-useCallback function with the compiler on #31475

Closed
ahkhanjani opened this issue Nov 10, 2024 · 1 comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@ahkhanjani
Copy link

The internet doesn't have much information about the compiler yet so I couldn't find an answer to this. I assume react compiler will simply memoize the functions declared inside the components like useCallback. Am I right?

If this is the case, there shouldn't be a need for this warning/error: The 'fn' function makes the dependencies of useEffect Hook (at line xx) change on every render. Move it inside the useEffect callback. Alternatively, wrap the definition of 'fn' in its own useCallback() Hook.

Is the react-hooks plugin conflicting with the compiler? Should we remove this plugin if we're using the compiler eslint plugin? Or is the warning actually right about this?

@ahkhanjani ahkhanjani added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Nov 10, 2024
@guillaumebrunerie
Copy link

See reactwg/react-compiler#18. The recommendation right now is to disable that rule indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

2 participants