Svelte.js: First Impressions

05/22/20191 Min Read — In JavaScript, Svelte.js

In the last two days, I started learning Svelte.js.

I'm positively surprised. Svelte is easy, and it works.

React's abstraction level is high, especially if you mix in JSX. With Svelte, you stay near "Vanilla-JS-Land." (Svelte.js compiles down to standard JavaScript.)

In a basic setup, your code also divides into three parts:

  1. The <script> block where you write JavaScript: you can define variables and write functions (typically event handlers).
  2. The CSS block where you write your component-scoped styles. (Yes, it's like styled components, but already shipped with Svelte.js)
  3. HTML with Svelte markup (here you can bind variables to buttons, etc. - similar to JSX)

That makes it easy to separate concerns visually and mentally.

Further Reading