I have a component which contains:
{#each menuItems as item}
<div class="menu-item {item.selected ? 'selected' : ''}" on:click={select(item)}>
...stuff...
</div>
{/each}
menuItems is an array of objects:
$: menuItem = [{
id: 'abc',
selected: true,
}]
I have a function called select which needs to take the item from the each loop as a parameter. How would I do this? The current example does not work due to on:click requiring a function like on:click={submit}. I have tried within quotation marks, and that did not work either.