What is Svelte?

Svelte is a component framework similar to React and Vue. What's different about Svelte?

Instead of interpreting your application code at run time, Svelte converts your application to vanilla JavaScript at compile time.

You can decide to build your entire app with Svelte or add it to your code slowly and gradually. With Svelte, you can also send the component as a standalone package.

Main Features

Here are some of the key features of Svelte, as well as their main differences from other frameworks.

Virtual DOM does not exist

We use Virtual DOM in React and Vue. Svelte does not use the Virtual DOM concept and instead shifts the job to an build step that occurs when you create your application.

With Svelte, code is compiled as vanilla JavaScript code without a small framework. It is guaranteed to be smaller and faster and does not require the use of Virtual DOM.

Less Code

Whodoesn'tlike to write a little code? The less code, the fewer errors. I'm not talking about compressing all your code into unreadable pieces of code. I'm talking about writing less code without hindering readability. Svelte was created to reduce the amount of code that developers write. In other modern frontend frameworks, there is quite a lot of standard code that comes with it.

Let's look at an example to see how Svelte compares to React. Let's look at an example to update the local component state using React and Svelte.


// Update state in React
const [count, setCount] = useState(0);
function increment() {
setCount(count + 1);


// Update state in Sveltelet count = 0;function increment() {
count += 1;

You can see how many codes have been cut in Svelte.

In React, we should use concepts such as useState or setState. In Svelte, however, this has been greatly simplified. You can update state directly with the assignment operator.

Complex State Management Libraries Do Not Exist

Managing your state in an application is one of the most difficult problems to solve. Svelte aims to move away from the trend of using complex state government libraries like Redux. To better understand this concept, you can watch this Youtube video by Svelte founder Rich Harris. Here, he talks about rethinking reactivity in frontend frameworks. This video will give you a good start to understand Svelte.



KARABAY A, 2020 . What is Svelte ?,


(Accessed November 03, 2020).

  Share this post

Comments (0)


Sign up for the email newsletter to be the first to know about my blog posts