# jsx-no-literals

Rule `react/jsx-no-literals`. Disallow usage of string literals in JSX

- Source: react
- Technologies: React
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1654 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `react/jsx-no-literals` | no | no | package `eslint-plugin-react` | [docs](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules/jsx-no-literals.md) |
| Oxlint | `react/jsx-no-literals` | no | no | plugin `react`, category restriction | [docs](https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-no-literals.html) |
| Biome | `style/noJsxLiterals` | no | no | group style, since 2.2.4 | [docs](https://biomejs.dev/linter/rules/no-jsx-literals/) |

## Code examples

### Incorrect: the rule reports this

```jsx
var Hello = <div>test</div>;
```

### Correct: the rule accepts this

```jsx
var Hello = <div>{'test'}</div>;
```

```jsx
var Hello = <div>
  {'test'}
</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-no-literals": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

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

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "noJsxLiterals": "error"
      }
    }
  }
}
```

## Related rules

- [react/no-unsafe](https://lintradar.dev/rules/react/no-unsafe.md): Disallow usage of unsafe lifecycle methods
- [react/checked-requires-onchange-or-readonly](https://lintradar.dev/rules/react/checked-requires-onchange-or-readonly.md): Enforce using `onChange` or `readonly` attribute when `checked` is used
- [react/forbid-component-props](https://lintradar.dev/rules/react/forbid-component-props.md): Disallow certain props on components
- [react/forbid-dom-props](https://lintradar.dev/rules/react/forbid-dom-props.md): Disallow certain props on DOM Nodes
- [react/forward-ref-uses-ref](https://lintradar.dev/rules/react/forward-ref-uses-ref.md): Require all forwardRef components include a ref parameter
- [react/hook-use-state](https://lintradar.dev/rules/react/hook-use-state.md): Ensure destructuring and symmetric naming of useState hook value and setter variables

---

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