I was wondering how to forward an event from a function with Svelte.
For example, I have an App.svelte and a Component.svelte files. Component.svelte is a button component. I want to handle the on:click event like so :
<script>
function handle(e){ /** Do things */ - /** Forward Event */ }
</script>
<button on:click={handle}/>
So I can also get the event from the App.svelte file
<script>
import Button from './component.svelte'
function handle(e){ /** Do something */ }
</script>
<div>
<Button on:click={handle}/>
</div>
I know you can forward events inside the component.svelte file by just filling an on:click attribute without specifying the function to call. But for my case, I need to have some internal logic going on inside my component. Or do I really need to create custom event handler for that ?
Thank you for your help :)