ButterCMS Logo

Svelte vs. Vue - Which One to Choose?

Published on
Updated on
16 min read
Svelte vs Vue featured image
GSD

 

For a long time, there were only three contenders for the title of “the best JavaScript UI framework” - React, Vue, and Angular. Each of them comes with a unique set of features, use-cases, target audiences, and general mindsets on how you should do things.

These frameworks have dedicated 3rd-party tools, libraries, and often entire communities of their own. For example, ButterCMS offers dedicated SDKs and APIs for Vue making the headless CMS integration process much easier.

But what about emerging players, like Svelte - a framework that offers high performance and improved development experience? How does it compare to an established player like Vue? Keep reading to uncover more insights about Vue vs. Svelte.

Let’s start with a quick overview of both frameworks.

Vue

vue homepage screenshot

You most likely already know Vue. It’s one of the most popular, open-source JavaScript UI frameworks out there. With its vast ecosystem, open community, and the release of v3 last year, Vue doesn’t seem to be slowing down.

Svelte

svelte homepage screenshot

Svelte is a younger framework (introduced in late 2016) that has only recently begun to gain traction. It’s one of the first and most successful tools that introduce compilation to modern UI frameworks. It aims at achieving high performance and smaller size of production code while providing an equally comfortable development experience.

Svelte vs. Vue: A side-by-side comparison

Svelte

  • Developed by Rich Harris
  • Released in 2016
  • Reusable code
  • Open-source
  • MIT Licence
  • No virtual DOM

Vue

  • Developed by Evan You
  • Released in 2014
  • Reusable code
  • Open-source
  • MIT Licence

Who uses Svelte and Vue?

Svelte

Various companies use Svelte to build web applications. These companies include:

  • Philips
  • GoDaddy
  • The New York Times
  • Square
  • Chess.com 

Vue

Some of the world's biggest brands use Vue to build interactive web interfaces. These companies include:

  • Google
  • Apple
  • Gitlab
  • Nintendo
  • Trustpilot
  • Trivago
  • Behance
  • Dribble

Facts about Svelte and Vue

Illustration: An open book with a Vue and Svelte logo on the inside

Svelte

  • At the time of writing this review, 13,395 websites were using Svelte.
  • Svelte has higher user satisfaction scores than Vue, according to the "State of JS" report in 2020.
  • More developers were interested in Svelte than Vue in 2020. 

Vue

  • At the time of writing this review, 2,283,277 websites were using Vue.
  • Vue is currently the most popular JavaScript front-end framework on GitHub.
  • More developers were aware of Vue than Svelte in 2020.

Toolchain and workflow

When choosing a framework, you should certainly look at metrics such as performance, ecosystem, and community support. But there are other, arguably less decisive factors, that will go on to heavily influence your development experience. Those include the framework’s workflow, templating syntax, and API - all the features needed to properly take advantage of the framework's full potential later on.

blog-cta-any-stack_800x100.png

Svelte and its compiler

The thing that’s so unique about Svelte is that it’s basically a compiler. With its own templating syntax and an API to go along with it, Svelte makes for a very smooth and efficient development process. 

Take a look at the source code of a basic counter written with Svelte, taken right from its website:

<script>
	let count = 0;

	function handleClick() {
		count += 1;
	}
</script>

<button on:click={handleClick}>
	Clicked {count} {count === 1 ? 'time' : 'times'}
</button>

This simple example illustrates the most important concepts that you’ll be dealing with most frequently while using the framework. 

What you see above is a Svelte component - a superset of HTML contained within a single .svelte file. Such a component consists of three sections:

  • <script> block containing JavaScript code that utilizes Svelte’s runtime API and manages the component’s state and properties through local variables and functions.