diff --git a/site/content/tutorial/06-bindings/14-component-this/app-a/App.svelte b/site/content/tutorial/06-bindings/14-component-this/app-a/App.svelte new file mode 100644 index 0000000000..41a6a10d3d --- /dev/null +++ b/site/content/tutorial/06-bindings/14-component-this/app-a/App.svelte @@ -0,0 +1,5 @@ + + + diff --git a/site/content/tutorial/06-bindings/14-component-this/app-a/InputField.svelte b/site/content/tutorial/06-bindings/14-component-this/app-a/InputField.svelte new file mode 100644 index 0000000000..e2b04b93ed --- /dev/null +++ b/site/content/tutorial/06-bindings/14-component-this/app-a/InputField.svelte @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/site/content/tutorial/06-bindings/14-component-this/app-b/App.svelte b/site/content/tutorial/06-bindings/14-component-this/app-b/App.svelte new file mode 100644 index 0000000000..f14332b398 --- /dev/null +++ b/site/content/tutorial/06-bindings/14-component-this/app-b/App.svelte @@ -0,0 +1,9 @@ + + + + + diff --git a/site/content/tutorial/06-bindings/14-component-this/app-b/InputField.svelte b/site/content/tutorial/06-bindings/14-component-this/app-b/InputField.svelte new file mode 100644 index 0000000000..e2b04b93ed --- /dev/null +++ b/site/content/tutorial/06-bindings/14-component-this/app-b/InputField.svelte @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/site/content/tutorial/06-bindings/14-component-this/text.md b/site/content/tutorial/06-bindings/14-component-this/text.md new file mode 100644 index 0000000000..00af193604 --- /dev/null +++ b/site/content/tutorial/06-bindings/14-component-this/text.md @@ -0,0 +1,19 @@ +--- +title: Binding to component instances +--- + +Just as you can bind to DOM elements, you can bind to component instances themselves. For example, we can bind the instance of `` to a prop named `field` in the same way we did when binding DOM Elements + +```html + +``` + +Now we can programmatically interact with this component using `field`. + +```html + +``` + +> Note that we can't do `{field.focus}` since field is undefined when the button is first rendered and throws an error. \ No newline at end of file