deno.com

jsx-no-useless-fragment

NOTE: this rule is included the following rule sets:recommendedreactjsxfresh
Enable full set in deno.json:
{
  "lint": {
    "tags": ["recommended"] // ...or "react", "jsx", "fresh"
  }
}
Enable full set using the Deno CLI:
deno lint --tags=recommended
# or ...
deno lint --tags=react
# or ...
deno lint --tags=jsx
# or ...
deno lint --tags=fresh

Fragments are only necessary at the top of a JSX "block" and only when there are multiple children. Fragments are not needed in other scenarios.

Invalid:

<></>
<><div /></>
<><App /></>
<p>foo <>bar</></p>

Valid:

<>{foo}</>
<><div /><div /></>
<>foo <div /></>
<p>foo bar</p>

Did you find what you needed?

Privacy policy