# jsx-no-useless-fragment

Rule `react/jsx-no-useless-fragment`. Disallow unnecessary fragments

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

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `react/jsx-no-useless-fragment` | no | safe | package `eslint-plugin-react` | [docs](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules/jsx-no-useless-fragment.md) |
| Oxlint | `react/jsx-no-useless-fragment` | no | safe | plugin `react`, category pedantic | [docs](https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-no-useless-fragment.html) |
| Biome | `complexity/noUselessFragments` | yes | unsafe | group complexity, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/no-useless-fragments/) |

## Code examples

### Incorrect: the rule reports this

```jsx
<>{foo}</>

<><Foo /></>

<p><>foo</></p>

<></>

<Fragment>foo</Fragment>

<React.Fragment>foo</React.Fragment>

<section>
  <>
    <div />
    <div />
  </>
</section>

{showFullName ? <>{fullName}</> : <>{firstName}</>}
```

### Correct: the rule accepts this

```jsx
{foo}

<Foo />

<>
  <Foo />
  <Bar />
</>

<>foo {bar}</>

<> {foo}</>

const cat = <>meow</>

<SomeComponent>
  <>
    <div />
    <div />
  </>
</SomeComponent>

<Fragment key={item.id}>{item.value}</Fragment>

{showFullName ? fullName : firstName}
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { react },
    rules: {
      "react/jsx-no-useless-fragment": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "react"
  ],
  "rules": {
    "react/jsx-no-useless-fragment": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "complexity": {
        "noUselessFragments": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [react/void-dom-elements-no-children](https://lintradar.dev/rules/react/void-dom-elements-no-children.md): Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children
- [react/button-has-type](https://lintradar.dev/rules/react/button-has-type.md): Disallow usage of `button` elements without an explicit `type` attribute
- [react/no-array-index-key](https://lintradar.dev/rules/react/no-array-index-key.md): Disallow usage of Array index in keys
- [react/no-danger](https://lintradar.dev/rules/react/no-danger.md): Disallow usage of dangerous JSX properties
- [react/no-object-type-as-default-prop](https://lintradar.dev/rules/react/no-object-type-as-default-prop.md): Disallow usage of referential-type variables as default param in functional component
- [react/prop-types](https://lintradar.dev/rules/react/prop-types.md): Disallow missing props validation in a React component definition

---

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