<div on:click={handleClick}>Click here</div>
Sometimes I want the div to be clickable, and sometimes I don't. How can I remove and add the click listener on demand?
This is the workaround that I used and it's working for now, but I feel like there must be a more elegant or sveltelcious way of doing it.
let disabled = false;function handleClick() { if (disabled) return; // do stuff otherwise}