Skip to content

jsx/prop-types doesn't trigger with React.forwardRef #1841

@yhaskell

Description

@yhaskell

eslint-plugin-react version: 7.9.1

If we create the functional component, the rule triggers:

const Label = ({ text }) => { 
  return <div>{text}</div>; // 'text' is missing in props validation
}

But if we convert this to a React.forwardRef component, it stops triggering:

const Label = React.forwardRef(({ text }, ref) => {
  return <div ref={ref}>{text}</div>; // no error
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions