DEV Community

Discussion on: 7 Event Modifiers in Svelte You Must Know

Collapse
 
opensas profile image
opensas

Excellent article as usual

Just a question, how can I use these event modifiers in my own components?

I want to make a custom button but I can't use these event modifiers, like this:

<MyButton on:click|preventDefault={clickHandler}>....
Enter fullscreen mode Exit fullscreen mode

Or at least how can I optionally apply those modifiers, so I can make something like

<MyButton prevenDefault on:click={clickHandler}>....
Enter fullscreen mode Exit fullscreen mode