<script>
	let x = 0;
</script>

<button on:click="{() => x++}">foo</button>

<p>x: {x}</p>