Why Svelte is changing the future of the web as we know it.

Frameworks in JavaScript

In the past few years, the definition of ‘framework’ and ‘library’ within the JavaScript ecosystem has varied in meaning, and different groups interpret the word in different ways.

In my own opinion: a library is something that can be imported as its own ‘piece of the puzzle’ (like D3), and a framework is a foundational architecture for building complex user interfaces.

Svelte: cybernetically enhanced web apps

That said, Svelte [my preferred option, and what this website is built with] technically isn’t either of those. Svelte, as opposed to runtime frameworks, is a compiler — something that builds and optimizes written code into machine-readable output. Because it’s a compiler, it’s fast. Really fast. In fact, Svelte usually outperforms common frameworks by a mile. If you want to find out how, I strongly suggest watching this talk by Rich Harris on Svelte’s unique approach to Reactivity in modern JavaScript.

But Svelte benefits from the best of both worlds. If you’ve worked with a framework before, Svelte will feel like a breath of fresh air, yet still familiar. You build out your components using simple, declarative HTML. Reactivity is as simple as reassigning a variable, as opposed to React’s useState()and setState, for example.

<script>
  let count = 0

  function increment() {
    count++ // or count = count + 1
  }
</script>

<button on:click={increment}>{count}</button>
  • Hello
  • Hello
  • Hello
  1. Hello
  2. Hello
  3. Hello

This is all that’s needed to update a value in Svelte. As you can image, this makes your life as a developer a lot simpler, since you simply need to write less code to create your applications.

If we can assume that more code = more bugs, and more bugs = more code, then we can assume more code = more code. By writing less code, we create less bugs. This makes us as developers happy, but also hugely benefits the users. Less code means applications are faster, even on low-end systems, and less bugs mean less frustrated users.

[work in progress]