💡 This rule is manually fixable by editor suggestions.
Requires that components wrapped with forwardRef must have a ref parameter. Omitting the ref argument is usually a bug, and components not using ref don't need to be wrapped by forwardRef.
See https://react.dev/reference/react/forwardRef
This rule checks all React components using forwardRef and verifies that there is a second parameter.
The following patterns are considered warnings:
var React = require('react');
var Component = React.forwardRef((props) => (
<div />
));The following patterns are not considered warnings:
var React = require('react');
var Component = React.forwardRef((props, ref) => (
<div ref={ref} />
));
var Component = React.forwardRef((props, ref) => (
<div />
));
function Component(props) {
return <div />;
};If you don't want to enforce that components using forwardRef utilize the forwarded ref.