Svelte Slots - Svelte Tutorial 14.1
WebJeda
Svelte slots are a way to add child elelments to Svelte components. Just like we can have child elements in a HTML division, we can have child elements or components in a Svelte component.
REPL: https://svelte.dev/repl/4daea1fa05c84e0697a53889ebc1e68d?version=3.32.0
The way we do this is by using a slot which is defining a place for the child elements.
Svelte slots can be really useful in building different layouts on a website. Building repeated cards etc.
In this video I have used Svelte slot to create a Jar and put fruits in it. This may be a bizarre example but I think it clearly explains the concept in a simpler way. I guess users can remember this for a long time.
#svelte #tutorial ... https://www.youtube.com/watch?v=ZYwNgrWSbeo
22401680 Bytes