Svelte Discovery Video Tutorial

Svelte is a JavaScript library that will allow you to simply create responsive components. The bookstore coming out in version 3 this weekend I suggest you discover it together.

The peculiarities of Svelte

Svelte proposes a rather important paradigm shift compared to existing libraries. Rather than rely on the use of VirtualDOM to limit the manipulation of the DOM, Svelte will generate the logic of manipulation of the DOM when compiling the code. This approach brings 2 major benefits:

  • Performance is improved because there is less code to execute when a state change occurs within a component.
  • The final code weight is much lower and depends on the number of features used in the code. This allows Svelte to offer a large number of features without necessarily impacting the weight of all applications.

And what does it look like?

A slender component will be written to a file .slender which will then be translated into JavaScript code. In order to limit the use of tools the syntax uses the classic JavaScript syntax with certain conventions.

For example, it is possible to declare reactive values ​​derived from other values ​​by prefixing the line with a $:

{count} * 2 = {doubled}

{doubled} * 2 = {quadrupled}

If you want to discover the library in depth do not hesitate to take a look at the tutorials offered by the documentation.