# prop-types

Rule `react/prop-types`. Disallow missing props validation in a React component definition

- Source: react
- Technologies: React
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 84.5M weekly downloads of presets that enable it
- Trend: +32.5% last quarter
- Rank: #211 by reach, #1073 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `react/prop-types` | yes | no | package `eslint-plugin-react` | [docs](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules/prop-types.md) |

## Code examples

### Incorrect: the rule reports this

```jsx
function Hello({ name }) {
  return <div>Hello {name}</div>;
  // 'name' is missing in props validation
}

var Hello = createReactClass({
  propTypes: {
    firstname: PropTypes.string.isRequired
  },
  render: function() {
    return <div>Hello {this.props.firstname} {this.props.lastname}</div>;
    // 'lastname' type is missing in props validation
  }
});

// Or in ES6
class Hello extends React.Component {
  render() {
    return <div>Hello {this.props.firstname} {this.props.lastname}</div>;
    // 'lastname' type is missing in props validation
  }
}
Hello.propTypes = {
  firstname: PropTypes.string.isRequired
}
```

```tsx
interface Props {
  age: number
}
function Hello({ name }: Props) {
  return <div>Hello {name}</div>;
  // 'name' type is missing in props validation
}
```

### Correct: the rule accepts this

```tsx
// destructured default prop values

function Foo({ bar = "" }): JSX.Element {
  return <div>{bar}</div>;
}

function Foo({ bar = "" as string }): JSX.Element {
  return <div>{bar}</div>;
}
```

```tsx
type Props = {
  name: string
}
class Hello extends React.Component<Props> {
  render() {
    return <div>Hello {this.props.name}</div>;
  }
}
```

```jsx
function Hello() {
  return <div>Hello World</div>;
}

// Referencing an external object disable the rule for the component
function Hello({ name }) {
  return <div>Hello {name}</div>;
}
Hello.propTypes = myPropTypes;
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { react },
    rules: {
      "react/prop-types": "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% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |

## Related rules

- [react/react-in-jsx-scope](https://lintradar.dev/rules/react/react-in-jsx-scope.md): Disallow missing React when using JSX
- [react/no-unknown-property](https://lintradar.dev/rules/react/no-unknown-property.md): Disallow usage of unknown DOM property
- [react/jsx-no-target-blank](https://lintradar.dev/rules/react/jsx-no-target-blank.md): Disallow `target="_blank"` attribute without `rel="noreferrer"`
- [react/display-name](https://lintradar.dev/rules/react/display-name.md): Disallow missing displayName in a React component definition
- [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

---

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