Skip to content

Instantly share code, notes, and snippets.

@sajt
Last active January 24, 2023 11:02
Show Gist options
  • Save sajt/6d97104a49a978bdfd47b594b6dd6b28 to your computer and use it in GitHub Desktop.
Save sajt/6d97104a49a978bdfd47b594b6dd6b28 to your computer and use it in GitHub Desktop.
<img src alt=“”valami> ugyanaz mint <img src={src} alt=“valami”> vagy <img src="{src}" alt=“valami”> // Ugyanaz a változó neve, mint az attribútum
<button on:click={handleClick}>
Clicked {count} {count === 1 ? 'time' : 'times'}
</button>
<script>
let count = 0;
let img = "https://i.imgflip.com/1g8my4.jpg"
$: doubled = count * 2; //reactív lesz
//Ez is működik
$: if (count >= 10) {
alert('count is dangerously high!');
count = 9;
}
function handleClick() {
count += 1;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment