File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,15 @@ Visit the [REPL demo](https://svelte.dev/repl/1d3e752c51b848e6af264f3244f3e85c?v
31
31
``` svelte
32
32
<script>
33
33
import { withPrevious } from 'svelte-previous';
34
+
35
+ export let name;
34
36
// current is writable, while previous is read-only.
35
- const [current, previous ] = withPrevious(0);
37
+ const [currentName, previousName ] = withPrevious(0);
36
38
// To update the values, assign to the writable store.
37
- setInterval(() => $current++, 1000) ;
39
+ $: $currentName = name ;
38
40
</script>
39
41
40
- from {$previous } to {$current }.
42
+ transition from {$previousName } to {$currentName }.
41
43
```
42
44
43
45
## Options
@@ -53,7 +55,6 @@ To track more than one value, set `numToTrack`.
53
55
``` svelte
54
56
<script>
55
57
const [current, prev1, prev2] = withPrevious(0, { numToTrack: 2 });
56
- setInterval(() => $current++, 1000);
57
58
</script>
58
59
59
60
from {$prev2} to {$prev1} to {$current}.
You can’t perform that action at this time.
0 commit comments