Vue · Junior · Question 33 of 75
What happens to attributes like class passed to a component that doesn't declare them as props?
<MyButton class="large" data-test="save" />- ✓Correct answer: They fall through to the component's root element
- 2They are silently dropped
- 3Vue throws an error about unknown props
Explanation
Fallthrough attributes (including listeners like @click) are applied to the single root element; class and style are merged. Use inheritAttrs: false with v-bind="$attrs" to move them elsewhere.