tick(): Waiting for DOM Updates
Await tick() to ensure the DOM reflects the latest state before reading layout values.
What tick Is
tick() returns a promise that resolves after pending state changes have been applied to the DOM.
Import It
Import from svelte.
<script>
import { tick } from "svelte";
</script>All lessons in this course
- onMount: Running After Render
- onDestroy: Cleanup
- beforeUpdate and afterUpdate
- tick(): Waiting for DOM Updates