prefer-shorthand-fragment
Rule category
Style.
What it does
Enforces the usage of fragment shorthand syntax.
Examples
Failing
import React from "react";
function function Example(): React.JSX.Element
Example() {
return (
<>
<JSX.IntrinsicElements.button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
button />
<JSX.IntrinsicElements.button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
button />
</>
);
}
Passing
import React, { const Fragment: React.ExoticComponent<{
children?: React.ReactNode | undefined;
}>
Lets you group elements without a wrapper node.Fragment } from "react";
function function Example(): React.JSX.Element
Example() {
return (
<const Fragment: React.ExoticComponent<{
children?: React.ReactNode | undefined;
}>
Lets you group elements without a wrapper node.Fragment>
<JSX.IntrinsicElements.button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
button />
<JSX.IntrinsicElements.button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
button />
</const Fragment: React.ExoticComponent<{
children?: React.ReactNode | undefined;
}>
Lets you group elements without a wrapper node.Fragment>
);
}