Vue · Junior · Question 32 of 75

How do you use a child component in <script setup>?

<script setup>
import UserCard from "./UserCard.vue";
</script>
<template><UserCard name="Ann" /></template>

Explanation

With <script setup> there is no separate registration step. Global registration via app.component() also works but prevents tree-shaking and hides dependencies.

Further reading

Problem with a question

Vue · Junior · question 32

Test yourself

Take the Vue · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz