Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
<script>
import { writable } from 'svelte/store';
// Make a store
const count = writable(0);

// Subscribe to it, and update the displayed value
let visibleCount = 0;
count.subscribe(value => {
visibleCount = value;
});

// A function to increment the count
function increment() {
count.update(n => n + 1);
}
</script>

<button on:click={increment}>Increment</button>
<p>Current value: {visibleCount}</p>
loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */