James
James

Reputation: 1475

When would Astro.slots.has() be useful

Hello wondered If any Astro users had ever found the Astro.slots.has() utility useful and or could explain to me how it could be used. The example code given in the docs is:

---
---
<slot />

{Astro.slots.has('more') && (
  <aside>
    <h2>More</h2>
    <slot name="more" />
  </aside>
)}

Why not just omit the named slot if you don't intend to use it and if its not dynamically imported? Or am I missing something.

Many thanks.

Upvotes: 0

Views: 12

Answers (0)

Related Questions