Skip to content

display-name has false positive on nested use of memo and forwardRef #2954

Closed
@fefrei

Description

@fefrei

Since #2399, eslint-plugin-react knows not to complain about code like this:

export const ComponentWithMemo = React.memo(function Component({ world }) {
 return <div>Hello {world}</div>
})

export const ComponentWithForwardRef = React.forwardRef(function Component({ world }) {
  return <div>Hello {world}</div>
})

In that pull request, nested use of memo and forwardRef like so...

export const ComponentWithForwardRef = React.memo(React.forwardRef(function Component({ world }) {
  return <div>Hello {world}</div>
}))

...was intentionally treated as a display-name violation due to a React bug causing such components to be anonymous. This issue was solved in November 2019, so the display-name should now accept this.

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