# jsx-newline

Rule `react/jsx-newline`. Require or prevent a new line after jsx elements and expressions.

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

## Linters

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

## Code examples

### Incorrect: the rule reports this

```jsx
<div>
  <Button>{data.label}</Button>
  <List />
</div>
```

```jsx
<div>
  <Button>{data.label}</Button>
  {showSomething === true && <Something />}
</div>
```

```jsx
<div>
  {showSomething === true && <Something />}
  {showSomethingElse === true ? (
    <SomethingElse />
  ) : (
    <ErrorMessage />
  )}
</div>
```

### Correct: the rule accepts this

```jsx
<div>
  <Button>{data.label}</Button>

  <List />

  <Button>
    <IconPreview />
    Button 2

    <span></span>
  </Button>

  {showSomething === true && <Something />}

  <Button>Button 3</Button>

  {showSomethingElse === true ? (
    <SomethingElse />
  ) : (
    <ErrorMessage />
  )}
</div>
```

```jsx
<div>
  <Button>{data.label}</Button>
  <List />
</div>
```

```jsx
<div>
  <Button>{data.label}</Button>
  {showSomething === true && <Something />}
</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/jsx-newline": "error",
    },
  },
];
```

## Related rules

- [react/jsx-child-element-spacing](https://lintradar.dev/rules/react/jsx-child-element-spacing.md): Enforce or disallow spaces inside of curly braces in JSX attributes and expressions
- [react/boolean-prop-naming](https://lintradar.dev/rules/react/boolean-prop-naming.md): Enforces consistent naming for boolean props
- [react/jsx-sort-props](https://lintradar.dev/rules/react/jsx-sort-props.md): Enforce props alphabetical sorting
- [react/no-adjacent-inline-elements](https://lintradar.dev/rules/react/no-adjacent-inline-elements.md): Disallow adjacent inline elements not separated by whitespace.
- [react/prefer-read-only-props](https://lintradar.dev/rules/react/prefer-read-only-props.md): Enforce that props are read-only
- [react/require-optimization](https://lintradar.dev/rules/react/require-optimization.md): Enforce React components to have a shouldComponentUpdate method

---

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