You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/content/docs/02-template-syntax.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -593,12 +593,12 @@ You can bind to component props using the same mechanism.
593
593
594
594
Components also support `bind:this`, allowing you to interact with component instances programmatically.
595
595
596
-
> Note that we can do `{cart.empty}`rather than `{() => cart.empty()}`, since component methods are closures. You don't need to worry about the value of `this` when calling them.
596
+
> Note that we can't do `{cart.empty}`since `cart` is `undefined` when the button is first rendered and throws an error.
597
597
598
598
```html
599
599
<ShoppingCartbind:this={cart}/>
600
600
601
-
<buttonon:click={cart.empty}>
601
+
<buttonon:click={() => cart.empty()}>
602
602
Empty shopping cart
603
603
</button>
604
604
```
@@ -1325,4 +1325,4 @@ It accepts a comma-separated list of variable names (not arbitrary expressions).
1325
1325
{@debug typeof user === 'object'}
1326
1326
```
1327
1327
1328
-
The `{@debug}` tag without any arguments will insert a `debugger` statement that gets triggered when *any* state changes, as opposed to the specified variables.
1328
+
The `{@debug}` tag without any arguments will insert a `debugger` statement that gets triggered when *any* state changes, as opposed to the specified variables.
0 commit comments