-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
Description
Describe the bug
If you have both onclick and on:click in the same component...
<script>
let count = $state(0);
function increment() {
count += 1;
}
</script>
<button onclick={increment}>
clicks: {count}
</button>
<button on:click={increment}>
clicks: {count}
</button>...the generated code is buggy — the handler is incorrectly hoisted, and count is undefined for the second handler.
Reproduction
Logs
No response
System Info
nextSeverity
annoyance