docs: update Keyed Each Blocks tutorial (#8188)

log which element is removed

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
pull/8314/head
Jhorman Ruswel ㅠㅠ 2 years ago committed by GitHub
parent 324b791d81
commit 85f882f23d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,6 @@
<script>
import { onDestroy } from 'svelte';
const emojis = {
apple: "🍎",
banana: "🍌",
@ -12,6 +14,11 @@
// ...but the "emoji" variable is fixed upon initialisation of the component
const emoji = emojis[name];
// observe in the console which entry is removed
onDestroy(() => {
console.log('thing destroyed: ' + name)
});
</script>
<p>

@ -1,4 +1,6 @@
<script>
import { onDestroy } from 'svelte';
const emojis = {
apple: "🍎",
banana: "🍌",
@ -12,6 +14,11 @@
// ...but the "emoji" variable is fixed upon initialisation of the component
const emoji = emojis[name];
// observe in the console which entry is removed
onDestroy(() => {
console.log('thing destroyed: ' + name)
});
</script>
<p>

Loading…
Cancel
Save