pull/5397/head
Tan Li Hau 5 years ago
parent 0d206e2600
commit 061525a565

@ -342,6 +342,31 @@ If you don't care about the pending state, you can also omit the initial block.
{/await}
```
### {#key ...}
```sv
{#key expression}...{/key}
```
---
Key block destroys and recreates the elements when the value of the expression changes.
This is useful if you want to transition the element whenever the expression value changes.
```sv
{#key value}
<div transition:fade>{value}</div>
{/key}
```
Another use case is to reinitialise a Svelte component.
```sv
{#key value}
<Component />
{/key}
```
### {@html ...}

Loading…
Cancel
Save