Problem Statement
What does Vue.nextTick (or nextTick) do and when do you need it?
Explanation
Vue batches DOM updates. nextTick schedules a callback after the DOM has been updated for the current tick. Use it when you need to access the updated DOM (e.g., measuring elements) right after changing reactive state.
Code Solution
SolutionRead Only
import { nextTick } from 'vue'
this.expanded = true
await nextTick()
const h = this.$el.getBoundingClientRect().heightPractice Sets
This question appears in the following practice sets: