Svelte provides a variety of built-in elements. The first, <svelte:self>, allows a component to contain itself recursively.

    It’s useful for things like this folder tree view, where folders can contain other folders. In Folder.svelte we want to be able to do this…

    1. {#if file.type === 'folder'}
    2. <Folder {...file}/>
    3. {:else}
    4. <File {...file}/>
    5. {/if}

    …but that’s impossible, because a file can’t import itself. Instead, we use <svelte:self>:

    1. {#if file.type === 'folder'}
    2. <svelte:self {...file}/>
    3. {:else}
    4. <File {...file}/>
    5. {/if}