# destructuring-assignment

Rule `react/destructuring-assignment`. Enforce consistent usage of destructuring assignment of props, state, and context

- Source: react
- Technologies: React
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 3.4M weekly downloads of presets that enable it
- Trend: +2.3% last quarter
- Rank: #1434 by reach, #1570 by growth

## Linters

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

## Code examples

### Incorrect: the rule reports this

```js
const MyComponent = (props) => {
  return (<div id={props.id} />)
};
```

```js
const Foo = class extends React.PureComponent {
  render() {
    return <div>{this.context.foo}</div>;
  }
};
```

```js
const MyComponent = ({id}) => {
  return (<div id={id} />)
};
```

### Correct: the rule accepts this

```js
const MyComponent = ({id}) => {
  return (<div id={id} />)
};
```

```js
const MyComponent = (props, context) => {
  const { id } = props;
  return (<div id={id} />)
};
```

```js
const Foo = class extends React.PureComponent {
  render() {
    const { title } = this.context;
    return <div>{title}</div>;
  }
};
```

Examples from the ESLint documentation.

## Enable it

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

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

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

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |

## Related rules

- [react/default-props-match-prop-types](https://lintradar.dev/rules/react/default-props-match-prop-types.md): Enforce all defaultProps have a corresponding non-required PropType
- [react/forbid-prop-types](https://lintradar.dev/rules/react/forbid-prop-types.md): Disallow certain propTypes
- [react/jsx-closing-bracket-location](https://lintradar.dev/rules/react/jsx-closing-bracket-location.md): Enforce closing bracket location in JSX
- [react/state-in-constructor](https://lintradar.dev/rules/react/state-in-constructor.md): Enforce class component state initialization style
- [react/jsx-closing-tag-location](https://lintradar.dev/rules/react/jsx-closing-tag-location.md): Enforce closing tag location for multiline JSX
- [react/no-will-update-set-state](https://lintradar.dev/rules/react/no-will-update-set-state.md): Disallow usage of setState in componentWillUpdate

---

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