<script>
	let things = [];
</script>

<button on:click="{() => { things.push(1); things = things }}">foo</button>

<p>number of things: {things.length}</p>