Skip to content

Instantly share code, notes, and snippets.

@blenderskool
Last active September 29, 2019 14:57
Show Gist options
  • Save blenderskool/7085267e470442f8b06cc64ce5334030 to your computer and use it in GitHub Desktop.
Save blenderskool/7085267e470442f8b06cc64ce5334030 to your computer and use it in GitHub Desktop.
Sample Svelte component
<!-- Script -->
<script>
export let name = 'world';
let num = 5;
function sayHello() {
console.log(`Hello ${name}`);
}
</script>
<!-- Styling -->
<style>
h1 {
color: red;
}
</style>
<!-- Markup -->
<h1>Hello {name}!</h1>
<input bind:value={num}>
<p>Double of num: {num * 2}</p>
<button on:click={sayHello}>Click me!</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment