Learn Svelte
Introduction
Basics
Hello world!
Adding data
Hello Svelte!
Hello SVELTE!
Dynamic attributes
Styling
This is styled paragraph.
Nested components
This is a paragraph from nested component
The answer is 100
HTML tags
this string contains some <strong>HTML!!!</strong>
this string contains some HTML!!!
Reactivity
Assignments
Count is 0
Declarations
0 doubled is 0
0 doubled is 0
Statements
$: { console.log("the count is " + count); if (count > 0) alert("I SAID THE COUNT IS " + count); } $: if (count >= 10) { alert("count is dangerously high!"); count = 9; }
Updating arrays and objects
1 + 2 + 3 + 4 = 10
Props
Declaring props
This is a paragraph from nested component
The answer is 42
Default values
This is a paragraph from nested component
The answer is 100
Spread props
The
svelte
package is blazing fast. Download version 3 from npm and learn more here
Logic
If blocks
Else blocks
Else-if blocks
7 is between 5 and 10
Each blocks
Await blocks
The number is 0.5773719027900985