$attrs is undefined when component has no props #6263
Steps to reproduce
Access $attrs as object within component context, when no props were provided.
What is expected?
$attrs is an object containing unrecognized props. Therefore I would expect an empty object, when no props are specified on component tag.
What is actually happening?
$attrs is undefined
The text was updated successfully, but these errors were encountered:
Just ran into this and it was definitely unexpected for me that
For example, if you were writing a todo app that starts out with no todos, it would be very strange to make the list begin as
For niche cases when a user wants to check if any
The part that really convinces me this is a bug though, is that
$attrs && Object.keys($attrs).length