Why this matters
Self-closing components communicate that they not only have no content, but are *meant* to have no content. It also makes your code cleaner.
Components with no content should be self-closing in Single-File Components, string templates, and JSX - but never in in-DOM templates.
Self-closing components communicate that they not only have no content, but are *meant* to have no content. It also makes your code cleaner.
Side-by-side examples engineers can pattern-match during review.
<MyComponent></MyComponent>
<my-component/>
<MyComponent/>
<my-component></my-component><MyComponent></MyComponent> <my-component/> <MyComponent/> <my-component></my-component> From the same buckets as this rule.
For applications, styles in a top-level `App` component and in layout components may be global, but all other components should always be scoped. This can be achieved through CSS modules, class-based strategies like BEM, or the `scoped` attribute in Single-File Components.