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
v7.20.6 has breaking changes for react/display-name #2758
Comments
This should fix the warning, and also improve debuggability of your components: const renderer = a => function SomeComponentName(listItem) {
return <div>{a} {listItem}</div>;
}; |
As noted by @ljharb the change is intentional and was introduced to fix an inconsistency that was in the library (you can read the whole discussion here: #2708 (comment)). Taking your own example: Before the change this was a component: const renderer = a => {
return listItem => ( // <-- component
<div>{a} {listItem}</div>
)
}; But this wan't: const renderer = a => listItem => ( <-- not a component
<div>{a} {listItem}</div>
); If you check carefully the code is basically the same. As also noted in the previous comment just setting any name to the last function solves the problem or you could disable the rule in that specific case: // eslint-disable-next-line react/display-name
const renderer = a => listItem => (
<div>{a} {listItem}</div>
); |
There is so much issue with displayName.
Inside function that isn't component - No fix found. Currently |
|
before
v7.20.6
thereact/display-name
rule was okay with this pattern:Since
v7.20.6
thereact/display-name
rule reports that "Component definition is missing display name" on line 1.There's nothing in the changelog for
v7.20.6
regarding the react/display-name rule so I suspect this is unintentional?I'm also confused as to how we'd fix this because
renderer
is not a component, nor is the function it returns. So maybe this is a false positive?The text was updated successfully, but these errors were encountered: