title: Passing Parent Method to Child in Svelte
body: <p>As the title suggests, I am trying to pass a method from a parent component to a child component.</p>
  <p>For example,</p>
  <p><em>App.html</em></p>
  <pre class="lang-html prettyprint-override"><code>&lt;div&gt;
    &lt;TodoItem
       done={todo.done}
       toggle={toggle}
    /&gt;
  &lt;/div&gt;
  &lt;script&gt;
   import TodoItem from './TodoItem.html';
   export default {
     components: {
       TodoItem,
     },
     methods: {
       toggle(index) {
         console.log(index);
       },
     },
   };
  &lt;/script&gt;
  </code></pre>
  <p><em>TodoItem.html</em></p>
  <pre class="lang-html prettyprint-override"><code>&lt;div&gt;
    &lt;button on:click=&quot;toggle(0)&quot;&gt;&lt;/button&gt;
  &lt;/div&gt;
  &lt;script&gt;
   export default {
     methods: {
       toggle(index) {
         // a guess. this works if you pass in console.log
         this.options.data.toggle(index)
       },
     },
   };
  &lt;/script&gt;
  </code></pre>
  <p>The desired functionality is that TodoItem calls the parent's method with its data.</p>
  <p>This example breaks, the console logs <code>TypeError: this.options.data.toggle is not a function</code>.</p>