4
7 Comments

Svelte framework - a perspective

I have tried the Svelte framework and I think it is marvelous.

I have dabbled in both React and Vue (but not Angular) and I found Svelte to be much easier to learn; it just seemed to be more 'intuitive' to me. It's also fast, both for development (it's a compiler, but I couldn't believe how fast it builds the website) and execution. The documentation is quite good. There are many articles comparing these frameworks/libraries, so this is more of a personal perspective. Currently, I do not have an online website built with Svelte, but I'm working on it.

Since Svelte is the new kid on the block of UI frameworks, it has fewer jobs out there, a smaller community of users, and fewer pre-built components - but it is growing in popularity.

There is one other, perhaps intangible, reason I like it as much as I do.

It is fun.

I can see progress, it makes sense to me, and I don't have to spend a lot of time on stack overflow (which I love, by the way, for both technical information and comedy relief).

React, Vue, Angular, and now Svelte are all marvelous products and huge advances in web development. Another huge advance, IMHO, was Flexbox, but I digress. If you enjoy programming for programming's sake, as I do, give Svelte a try! Any thoughts?

on June 11, 2022
  1. 1

    How easy have you found it to develop a backend using Svelte? I've understood you can build a full-stack application using Svelte and Sveltekit, but that the latter requires a lot of plugins and creates dependencies. I wonder how easily you can abstract those by using Firebase or SupaBase for the database, authentication etc.

    1. 2

      I moved from Svelte to SvelteKit in the year since my original post, and it is a joy to work with. I am using Vercel and Atlas MongoDB (database) for my development, and they work together well. I am not doing authentication (yet), but I do use Zod for validation and Tailwind CSS. I am also playing around with Flowbite SvelteKit, which combines Tailwind, Flowbite and SvelteKit. My limited understanding of React is that you do need plugins for a number of things, whereas, with SvelteKit, aside from the plugins I mentioned, provides enough functionality 'out of the box' to satisfy my needs. It is one of the beauties of SvelteKit.

      1. 1

        Thanks for the thorough response! Glad you're liking the experience. I'm learning JS now and will be progressing to Svelte once I've got the basics down.

  2. 1

    I always say I am to dumb for react. Svelte gave me freedom.

    1. 1

      Einstein said "Make everything as simple as possible, but not simpler." This sums up my thoughts on Svelte.

  3. 1

    What was the difference between Vue and Svelte? have you tried the new SFC for Vue?

    1. 1

      Svelte is a compiler - a fast one at that - and it does not create a virtual dom, as Vue and React do. As far as the programming goes, Svelte seems a little more streamlined, to me. I think I can best show this by example.

      To increment a value using a button in Svelt and Vue:

      In Svelte
      <script>
      let count = 0;
      const increment = () => { count = count + 1; }
      </script>

      <h1>{count}</h1>
      <button on:click={increment}>Increment Count</button>

      In Vue
      <template>
      <div class="message"># {{ count }}<br>
      <p># {{ count }}</p>
      < button v-on:click.prevent="increment">+</button>
      </div>
      </template>

      <script>
      export default {
      data: ()=> {
      return {
      count: 0
      }
      },
      methods: {
      increment () {
      this.count++;
      }
      }
      }
      </script>

      I did not run the Vue example so this is not a rigorous test, but I hope you get the idea of how I got my impressions.

      To answer your SFC question, it has been a while since I used Vue so if there is a new SFC I have not tried it. As I recall, I liked using Vue, but when I tried Svelte the the language/syntax came more naturally to me.