title: Svelte, EventDispatcher or function as a value? What to use?
body: <p>Reading the code on this amazing Modal example: <a href="https://svelte.dev/examples#modal" rel="nofollow noreferrer">https://svelte.dev/examples#modal</a> I'm trying to understand what's the difference in terms of performances/bundle size/other if I use:</p>
  
  <ol>
  <li><code>createEventDispatcher()</code> with directive like <code>on:close={()=&gt; doSomething()}</code> or</li>
  <li>simply pass the function as a value like <code>action={doSomething}</code>.</li>
  </ol>
  
  <p>Also in the first case I can't use <code>on:close={...}</code> on the <code>slot</code>s, right?</p>
  
  <p>If I try it gives me this error: <code>[!] (plugin svelte) ValidationError: &lt;slot&gt; cannot have directives</code></p>
  
  <p><strong>What do you recommend to use?</strong></p>