Vue · Middle · Question 17 of 75

What does defineExpose do in <script setup>?

Explanation

<script setup> components are closed by default: a parent's ref gets nothing. defineExpose({ focus }) lets the parent call childRef.value.focus().

Further reading

Problem with a question

Vue · Middle · question 17

Test yourself

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

Take this quiz