Skip to content

react/display-name false positive when using React.memo #2105

Closed
@Raigen

Description

@Raigen

[email protected]

We have a functional component that is exported with React.memo

import React from 'react'
import { string } from 'prop-types'

function Component({ world }) {
  return <div>Hello {world}</div>
}

Component.propTypes = {
  world: string,
}

export default React.memo(Component)

This triggers the react/display-name error after the update from 7.11.1

[...]/Component.jsx
  12:16  error  Component definition is missing display name  react/display-name

The exported components displayName is Memo(Component).

Without React.memo it recognizes the displayName.

export default 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