svelte
svelte copied to clipboard
Parameter to control the state of transitions without necessarily using If.
Describe the problem
Sometimes it is not necessary to place an If to control transitions, in specific cases the layout may break.
Describe the proposed solution
<div transition:fade={{ show: true }}>
Alternatives considered
Set a parameter to control the state of the transition.
Importance
nice to have
Without an example of cases where the layout breaks, it's hard to know whether this is truly needed. I assume you've already encountered one such case. In that case, would {#key}
(https://svelte.dev/docs#template-syntax-key) have worked for you in place of {#if}
?
I tried, specifically I'm using Fly for scrolling, but as such #key just updates it.
I'm reevaluating my comments, because the layout as such doesn't break, it would break if the Handle Button was visible in the mobile version.
But now that we are here I still consider that it would be nice to control the state of the transitions with a parameter, or something that solves repeating code that many have chosen to do this.
`{#if some}