Answers for "svelte ondestroy"

0

svelte ondestroy

<script>
	import { onDestroy } from 'svelte';

	let counter = 0;
	const interval = setInterval(() => counter += 1, 1000);

	onDestroy(() => clearInterval(interval));
</script>
Posted by: Guest on September-04-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language