0

I am a svelte beginner and i have a problem with event handlers inside the each block. In the Repl when i click shuffle multiple times, i have multiple event listener for the heart inside the card. The click event on the card works fine and has only one event listener. How can i prevent to have multiple event listeners on the heart?

Repl

1 Answer 1

1

You could remove they key, that way the items are re-created, and the event handlers aren't sticking around.

{#each dataShow as d (d.poi)} => {#each dataShow as d}

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.