Vue · Junior · Question 40 of 75
Where should you access the DOM after the component is rendered?
- ✓Correct answer: In
onMounted - 2Directly in
<script setup>, which runs after rendering - 3In
onBeforeMount
Explanation
<script setup> runs before the component is mounted, so the DOM doesn't exist yet. onMounted runs after the first render; it is also never called during SSR.