# react/jsx-no-comment-textnodes

> Disallow `//` and `/* */` comments written as text between JSX tags

Between JSX tags, `//` and `/* */` don't start a comment. They're text, and your users see it on the page. A comment there must be inside braces.

The rule reports text that has a line starting with `//` or `/*`.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"react/jsx-no-comment-textnodes" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad {"count": 2} */}
```jsx
const header = (
  <header>
    // TODO: add the logo
    <h1>Welcome</h1>
    /* the subtitle goes here */
  </header>
);
```

Not reported:

{/* good */}
```jsx
const header = (
  <header>
    {/* TODO: add the logo */}
    <h1>Welcome</h1>
    <a href="https://bun.com">See https://bun.com</a>
  </header>
);
```

To show text like that on purpose, write it as a string in braces:

{/* good */}
```jsx
const hint = <code>{"// a comment in JavaScript"}</code>;
```
