I need to display html when variable (in this repl - num) is truthy
And I also need to animate first tag after each change of another variable(slide)
If I have html structure like this:
{#key animateOnChangeVariable}
{#if variableIsTrythy}
<div class="first">First tag</div>
{/if}
{/key}
<div class="second">Second tag</div>
And if num is changed, first tag is inserted after second (html order is changed)
REPL
https://svelte.dev/repl/3ba09b8c428c4ee58c77ff477b5fa632?version=3.29.7
If {#if} and {#key} swapped, everything works correctly
Also, if you have several buttons at the same time, which change num by clicking - an error is thrown (uncomment second button, uncomment function and get error div1 is not defined).
I need to display html when variable (in this repl -
num) is truthyAnd I also need to animate
firsttag after each change of another variable(slide)If I have html structure like this:
{#key animateOnChangeVariable} {#if variableIsTrythy} <div class="first">First tag</div> {/if} {/key} <div class="second">Second tag</div>And if
numis changed,firsttag is inserted aftersecond(html order is changed)REPL
https://svelte.dev/repl/3ba09b8c428c4ee58c77ff477b5fa632?version=3.29.7
If
{#if}and{#key}swapped, everything works correctlyAlso, if you have several buttons at the same time, which change num by clicking - an error is thrown (uncomment second button, uncomment function and get error
div1 is not defined).