Skip to content

Commit 9b98894

Browse files
tijnjhtijn
andauthored
docs: use svelte 5 syntax in readme (#2785)
Co-authored-by: tijn <[email protected]>
1 parent 3b30d5e commit 9b98894

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,17 @@ A `.svelte` file would look something like this:
2222

2323
```html
2424
<script>
25-
let count = 1;
25+
let count = $state(1);
2626
27-
// the `$:` means 're-run whenever these values change'
28-
$: doubled = count * 2;
29-
$: quadrupled = doubled * 2;
27+
let doubled = $derived(count * 2);
28+
let quadrupled = $derived(doubled * 2);
3029
3130
function handleClick() {
3231
count += 1;
3332
}
3433
</script>
3534

36-
<button on:click="{handleClick}">Count: {count}</button>
35+
<button onclick={handleClick}>Count: {count}</button>
3736

3837
<p>{count} * 2 = {doubled}</p>
3938
<p>{doubled} * 2 = {quadrupled}</p>

0 commit comments

Comments
 (0)