Svelte · Middle · Question 60 of 75
How do you render fallback content when no children snippet was passed?
{#if children}
{@render children()}
{:else}
<p>Nothing here</p>
{/if}- ✓Correct answer: Check the snippet prop in
{#if}and render a fallback in{:else} - 2
<slot>Fallback</slot>is the only way - 3Snippets always have default content
Explanation
Snippet props are just values that may be undefined; for a simple render without fallback use {@render children?.()}.