Self-Closing

Always self-close tags that have no children.

ESLint: react/self-closing-comp

Examples

Incorrect code for this rule:

<Snow season="winter"></Snow>

Correct code for this rule:

<Snow season="winter" />

Closing Bracket Indentation

If a component has multi-line properties, close its tag on a new line.

ESLint: react/jsx-closing-bracket-location

Examples

Incorrect code for this rule:

<Snow
  season="winter"
  density={20} />

Correct code for this rule:

<Snow
  season="winter"
  density={20}
/>

results matching ""

    No results matching ""