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/each-block-keyed-index-in-e.../main.svelte

16 lines
250 B

<script>
let list = ["a", "b", "c"];
const remove = index => {
list.splice(index, 1);
list = list;
};
</script>
{#each list as value, index (value)}
{#if value}
<button on:click="{e => remove(index)}">
remove
</button>
{/if}
{/each}