Skip to content

False positive for react/display-name when using memo #3303

@sevdog

Description

@sevdog

After upgrading to 7.30 we have found out that some function component are highlighted by this rule even if they are declared with normal functions rather than arrow functions.

Looking at the code base we found out that these happens only for those components which has an arrow comparison function:

function MyComponent(props) {
   return <b>{props.name}</b>;
}

const MemoizedMyComponent = React.memo(
    MyComponent,
    (prevProps, nextProps) => prevProps.name === nextProps.name
)

It looks like the linter considers the comparison function as an other component.

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