Back to Denoland

Jsx No Useless Fragment

lint/rules/jsx-no-useless-fragment.md

latest309 B
Original Source

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:

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

Valid:

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