Skip to content

Suggestion: Rule to Disallow use of forwardRef in React 19 #3915

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

Open
2 tasks done
NishargShah opened this issue Apr 2, 2025 · 4 comments
Open
2 tasks done

Suggestion: Rule to Disallow use of forwardRef in React 19 #3915

NishargShah opened this issue Apr 2, 2025 · 4 comments
Labels

Comments

@NishargShah
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

React 19 is here and still we don't force user to not use forwardRef, so is it good to have the rule

Expected Behavior

eslint-plugin-react version

V7.37.4

eslint version

V9

node version

V22

@NishargShah NishargShah added the bug label Apr 2, 2025
@ljharb
Copy link
Member

ljharb commented Apr 2, 2025

Duplicate of #3192.

@ljharb ljharb closed this as completed Apr 2, 2025
@NishargShah
Copy link
Author

How it is duplicate, I didn't get that. plus, it is opened in 2022 and there is no discussions regarding removing the forwardRef

@ljharb
Copy link
Member

ljharb commented Apr 2, 2025

hmm, i'll reopen, but it seemed like one to me.

@ljharb ljharb reopened this Apr 2, 2025
@ankhzet
Copy link

ankhzet commented Apr 28, 2025

Also, since react 19 ref should probably be a default exception for react/prop-types rule (for functional components), as ref is now supported by functional components by default, without wrapping them in the forwardRef. For now adding ref to the react/prop-types options.ignore can be used as a workaround, i think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants