- 0 kr
Svelte – a new star on the frontend sky?
The newcomer Svelte is already at the top of the list for peaking the programmers' interest (source). A few years back, React turned the world of web development upside down with its Virtual DOM, which has significant benefits comparing to traditional DOM handling. Now it might be Svelte's turn with their new approach.
Svelte is run during the building phase and converts your components into a very efficient imperative code which surgically updates your DOM. This makes it possible for you to write ambitious applications with excellent performance characteristics. Svelte is meant to be used where you need minimal script download, and where other frameworks are too bulky. It is mainly aimed for so called "embedded web" environments – such as wearables, internet-of-things, Smart TVs, etc. – where every kilobyte counts.
In the benchmark tests, Svelte beats React and Angular regarding speed on practically all fronts. It is a fast framework, that is undebatable, but do those shaven off milliseconds automatically mean it is always the better framework? That is worth thinking about.
Svelte does not handle reactive programming in the same way as React's state handling or Vue's getter and settlers, but in an even more minimal way, where a simple allocation to a variable makes the page refresh. Reactive programming deals with data streams and flows where a change to a variable creates a chain effect, depending on its underlying depending variables.
Also Microsoft's WPF supports the model. For many, this is an attractive model in order to get more interactive interfaces.
CSS in Svelte
CSS in Svelte components are scoped to the component and does not leak. That is good, because that eliminates the need for yet another library to fix that. However, you can also use CSS-in-JS, similar to the Styled Components React has, if you prefer that.
Svelte for the win
Svelte offers a lot of the features a developer expects from a frontend framework, but with the upside of creating very minimal scripts. Does Svelte have what it takes to take over the crown from React and become the most used framework?
As usual React and Vue lead the pack, but Svelte is quickly establishing itself as a very serious contender for the front-end crown. Källa
The battle for the throne depends on a number of factors – perhaps mainly on the demand that Svelte must be able to solve the same problems as React, but in a more efficient way, which will make it easier to develop the same type of functionality. Is it possible for Svelte to compete with the already established frameworks, or will it only be used when the highest priority is shaving off milliseconds? One example of this is environments that need minimal script files with bad bandwidth, where Svelte is a really interesting alternative.
- Svelte - Examples - 'Hello World'
- GitHub - Svelte
- Video: Rich Harris - Rethinking reactivity
- Video: Svelte and the Great Space Elevator (MagnoliaJS Conf 2020)
By: Marko Poikkimäki