Question · Vue.js course · Module 8: Slots & Dynamic Components

useSlots in script setup

How do you check in script setup whether the parent passed content to the 'header' slot?

Answer options

  • if (props.header)
  • if (slots.header)
  • const slots = useSlots(); if (slots.header)
  • if ($slots.header) in the template

You can check the correct answer by solving this task in the CodeWorlds game.