I'm wondering if it's possible to do this #15457
Unanswered
frederikhors
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hello, I didn't understand why you cannot use the {#each}/{#if} ? Seem fine to me : {#each players as player, index (player.id)}
{#if player.isOld}
<Player {index} bind:player={players[index]} />
{/if}
{/each} The filtered array won't work with bind, because the index do no matches the index of the initial array. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As you can see in this Svelte 5 playground example I have
players
and I need to show bothold
and not ones using separateeach
.But even when it starts you can see that the elements of the
each
are wrong.If I use one button to add new one to the array it shows both of them not in the correct filtered
each
.Why?
I cannot use:
<Player bind:player={player} />
because of:and I cannot use:
because I need to show the index in the list too.
Is there another way?
Beta Was this translation helpful? Give feedback.
All reactions