Svelte Hello World

JavaScript is one of the most popular programming languages in the world, and new frameworks are released almost every day. Amongst all of these options, Svelte is becoming a hot trend. So what is Svelte, and why is it gaining popularity?

Svelte is a JavaScript framework that helps developers create high-performance web applications. Unlike other frameworks, which use virtual DOMs to keep track of changes in the app, Svelte uses a reactive approach that updates the DOM directly.

This means that apps built with Svelte tend to be faster and more responsive. In addition, Svelte code is easy to read and understand, making it a good option for beginners. With its growing popularity, Svelte is worth checking out for any JavaScript developer.

Svelte Hello World

Let’s take a look at the most simple application created with Svelte, “Hello World.”

<script>
	let name = 'world';
</script>

<h1>Hello {name}!</h1>

<style>
	h1{color: red;}
</style>

To create the first boilerplate script with the respective folder structure, you run the following command:

//install project with degit
npx degit sveltejs/template svelte-app-name
import App from './App.svelte';
const app = new App({
    target: document.body,
    props: {
        name: 'world'
    }
});
export default app;

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close