Performance: Components and slots
MEDIUM IMPACT
This affects page load speed and rendering performance by controlling how reusable UI parts are rendered and how much DOM is generated.
<!-- Blade component usage -->
<x-card>
<x-slot name="title">{{ $title }}</x-slot>
{{ $slot }}
</x-card><!-- Blade template without components -->
<div>
<h2>{{ $title }}</h2>
<p>{{ $slot }}</p>
</div>
<!-- Repeated inline in many places -->| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Inline repeated markup | High (many duplicated nodes) | Multiple reflows per repeated block | High paint cost due to large DOM | [X] Bad |
| Blade components with slots | Low (reusable nodes) | Single reflow for component | Lower paint cost with smaller DOM | [OK] Good |