You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/component-event-handler-dyn.../main.svelte

11 lines
291 B

<script>
import Button from './Button.svelte';
export let count = 0;
let clickHandler = () => count += 1;
function updateHandler(){
clickHandler = () => count += 10;
}
</script>
<button on:click={updateHandler}>update handler</button>
<Button on:click={clickHandler}>{count}</Button>