Rules
no-useless-forward-ref
Full Name in eslint-plugin-react-x
Full Name in @eslint-react/eslint-plugin
Features
🔍
Presets
core
recommended
recommended-typescript
recommended-type-checked
What it does
Enforces that forwardRef
is only used when a ref
parameter is declared.
This rule enforces that:
- Components using
forwardRef
must declare aref
parameter - Components not using
ref
should not be wrapped withforwardRef
Examples
Failing
Passing
Implementation
Further Reading
See Also
no-forward-ref
Replaces usages offorwardRef
with passingref
as a prop.