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.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!