WTF is Svelte?

Tomasz Łakomy
InstructorTomasz Łakomy

Share this video with your friends

Send Tweet
Published 3 years ago
Updated a year ago

Svelte is a tool for building fast web applications.

In this lesson we're going to learn what is Svelte and what's the difference between Svelte and other frameworks such as React or Vue.

Instructor: [0:00] Svelte is a tool for building fast web applications. In that regard, it's a bit similar to frameworks such React and Vue, which also share the same goal of building fast web interfaces.

[0:09] There's one major difference. The difference is that Svelte converts your app to optimize JavaScript code at the build time rather than interpreting your application code at the run time. What that means is that if we have this Hello World header over here, after I switch the JS output, this is actually the code that is going to be run by our users.

[0:27] There's also going to be a CSS output if you're going to have any styles in our Svelte application. If I were to switch to a bit more complicated example, so this is a simple app that allows me to see my mouse position, and here we have the script object, here we have the styles, and this is the markup with the onMouseMove handle.

[0:45] Here in the JS output, we do can see optimized JavaScript code built by Svelte, so we can ship that to our users and also Svelte takes care of the performance.

[0:53] We, as Svelte developers, don't have to optimize so much for performance because all this work is being done by the compiler. If we have any styles in our Svelte application, we're going to get the CSS output as well. We've pre-generated class names. We don't have to worry about that either.