stopEvent(e) calls all stop methods —
preventDefault,
stopPropagation, and
stopImmediatePropagation — in
one call. Useful as a one-liner handler body, or composed with other
handlers. Part of pota/use/event.
Drop the stop helpers directly into on:* handlers — preventDefault
suppresses the default action, while stopEvent does that plus halts
propagation and any sibling listeners.
import { render } from 'pota'
import { stopEvent, preventDefault } from 'pota/use/event'
function App() {
return (
<div>
<a
href="https://example.com"
on:click={preventDefault}
>
click me (default prevented, link does not navigate)
</a>
<hr />
<button on:click={stopEvent}>
button — click is swallowed (no default, no bubble)
</button>
</div>
)
}
render(App)