You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The react/display-name documentation doesn't explicitly state it, but the rule seems to accept display names as properties inside components.
=> Documentation needs to be updated
When the displayName was defined as a property, I think the rule should ensure that the declaration is static, so the following case should be rejected:
class Demo extends Component {
displayName = "Demo"
}
Whereas the following should be accepted:
class Demo extends Component {
static displayName = "Demo"
}
The text was updated successfully, but these errors were encountered:
We should definitely add test cases to ensure that a non-static class field does not satisfy the rule; additionally, we should probably add an option that forces it to be a static class field rather than an external property.
In your example, however, the function’s name is sufficient, and your non-static class field has no effect. You’d need to use an anonymous class with a non-static property to see if the rule really accepted it (i believe it won’t)
The
react/display-name
documentation doesn't explicitly state it, but the rule seems to accept display names as properties inside components.=> Documentation needs to be updated
When the
displayName
was defined as a property, I think the rule should ensure that the declaration isstatic
, so the following case should be rejected:Whereas the following should be accepted:
The text was updated successfully, but these errors were encountered: