Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sevdog opened this issue Jun 1, 2022 · 2 comments · Fixed by #3304
Closed

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

sevdog opened this issue Jun 1, 2022 · 2 comments · Fixed by #3304

Comments

@sevdog
Copy link

sevdog commented Jun 1, 2022

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.

@ljharb
Copy link
Member

ljharb commented Jun 1, 2022

cc @golopot

@golopot
Copy link
Contributor

golopot commented Jun 1, 2022

This bug is caused by #3276.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants