Svelte in 60 Seconds

Rodrigo Pombo
InstructorRodrigo Pombo

Share this video with your friends

Send Tweet
Published 5 months ago
Updated 5 months ago

Learn Svelte fast. This is a quick overview of how to use Svelte core features compressed into one minute. Remember to pause the video if you need time to understand something!

This lesson uses Svelte v3.

To learn more about Svelte and the rest of the features we haven't covered, visit the official website.

Rodrigo Pombo: [0:01] Svelte uses a custom file format similar to HTML. You can use curly braces to render data. Every Svelte file is a different component. You can add imports inside the script tag. To share the data with children components, you can create props using this port keyword.

[0:22] Inside curly braces, you can put any JavaScript expression. With the on directive, you can listen to events. Here, when the goalCount changes after a click, Svelte will re-render the component. You can also use a custom event to share data with the parent and use the on directive again to handle it and do something with the data.

[0:46] If you want to render a list, you can use the each block. Svelte also supports style tags. Here, the style only applies to the div from the current component and not the others.