Last active
September 29, 2019 14:57
-
-
Save blenderskool/7085267e470442f8b06cc64ce5334030 to your computer and use it in GitHub Desktop.
Sample Svelte component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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