Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

GreggHume
GreggHume

Posted on

     

Svelte 5: Slot / children example

Svelte 5 has deprecated the slot tag. So now you have to use children, but its not clear how to do this.

Here is an example of how to use the slot / children in the layout component.

<scriptlang="ts">let{children}=$props();</script>{@renderchildren()}
Enter fullscreen modeExit fullscreen mode

Before doing this you will see errors like:
"Using<slot> to render parent content is deprecated. Use{@render ...} tags instead"

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
james_hets_801d11230fe93f profile image
James Hets
  • Joined

Thank you! I don't understand the reason why documentation doesn't make it explained like yours!

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

A developer who works with and on some of the worlds leading brands. My company is called Cold Brew Studios, see you out there :)
  • Joined

More fromGreggHume

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp