Rules
no-useless-forward-ref
Full Name in eslint-plugin-react-x
Full Name in @eslint-react/eslint-plugin
Presets
core
recommended
recommended-typescript
recommended-type-checked
Description
Disallow useless forwardRef
calls on components that don't use ref
s.
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.