The problem is that in svelte on:click triggers on page load for some reason. Can anybody explain to me why it's happening and how to prevent it so it only triggers when you actually check the box. This only happens if on:click is inside each block.
<script>
function handleClick(number) {
alert(number)
}
let numbers = [1,2,3,4,5,6]
</script>
{#each numbers as number}
<input type=checkbox on:click={handleClick(number)}>
{/each}
You can look at it here