# display-name

Rule `react/display-name`. Disallow missing displayName in a React component definition

- Source: react
- Technologies: React
- Kind: suspicious
- Needs type information: no
- Autofix: no
- Reach: 128M weekly downloads of presets that enable it
- Trend: +39.1% last quarter
- Rank: #135 by reach, #1033 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `react/display-name` | yes | no | package `eslint-plugin-react` | [docs](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules/display-name.md) |
| Oxlint | `react/display-name` | no | no | plugin `react`, category pedantic | [docs](https://oxc.rs/docs/guide/usage/linter/rules/react/display-name.html) |

## Code examples

### Incorrect: the rule reports this

```jsx
var Hello = createReactClass({
  render: function() {
    return <div>Hello {this.props.name}</div>;
  }
});

const Hello = React.memo(({ a }) => {
  return <>{a}</>
})

export default ({ a }) => {
  return <>{a}</>
}
```

### Correct: the rule accepts this

```jsx
var Hello = createReactClass({
  displayName: 'Hello',
  render: function() {
    return <div>Hello {this.props.name}</div>;
  }
});

const Hello = React.memo(function Hello({ a }) {
  return <>{a}</>
})
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import react from "eslint-plugin-react";

export default [
  {
    plugins: { react },
    rules: {
      "react/display-name": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "react"
  ],
  "rules": {
    "react/display-name": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [React recommended](https://lintradar.dev/presets/react-recommended.md) | ESLint | `eslint-plugin-react` | 21 | 81.1M | +34.1% |
| [Next.js Core Web Vitals](https://lintradar.dev/presets/next-core-web-vitals.md) | ESLint | `eslint-config-next` | 62 | 46.8M | +48.8% |

## Related rules

- [react/jsx-no-target-blank](https://lintradar.dev/rules/react/jsx-no-target-blank.md): Disallow `target="_blank"` attribute without `rel="noreferrer"`
- [react/no-deprecated](https://lintradar.dev/rules/react/no-deprecated.md): Disallow usage of deprecated methods
- [react/no-unescaped-entities](https://lintradar.dev/rules/react/no-unescaped-entities.md): Disallow unescaped HTML entities from appearing in markup
- [react/no-find-dom-node](https://lintradar.dev/rules/react/no-find-dom-node.md): Disallow usage of findDOMNode
- [react/no-direct-mutation-state](https://lintradar.dev/rules/react/no-direct-mutation-state.md): Disallow direct mutation of this.state
- [react/jsx-uses-vars](https://lintradar.dev/rules/react/jsx-uses-vars.md): Disallow variables used in JSX to be incorrectly marked as unused

---

Web page: https://lintradar.dev/rules/react/display-name. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
