Update tutorial on component binding

Updated sample code to remove boilerplate code and removed note warning about an error that is no longer present
pull/6852/head
Dan Armour 5 years ago
parent 883c47b45d
commit 480ec2f932

@ -6,4 +6,4 @@
<InputField bind:this={field}/>
<button on:click={() => field.focus()}>Focus field</button>
<button on:click={field.focus}>Focus field</button>

@ -11,9 +11,7 @@ Just as you can bind to DOM elements, you can bind to component instances themse
Now we can programmatically interact with this component using `field`.
```html
<button on:click="{() => field.focus()}">
<button on:click="{field.focus}">
Focus field
</button>
```
> Note that we can't do `{field.focus}` since field is undefined when the button is first rendered and throws an error.
```
Loading…
Cancel
Save