---
title: Self-Referencing Components Use Filename as Implicit Name
impact: LOW
impactDescription: Understanding this avoids confusion with recursive components
type: gotcha
tags: [vue3, component-registration, self-reference, recursive-components, sfc]
---
# Self-Referencing Components Use Filename as Implicit Name
**Impact: LOW** - In Single-File Components (SFC), a component can reference itself in its own template using its filename as the component name. This is useful for recursive components like tree structures or nested comments. However, this implicit registration has lower priority than explicitly imported components, which can cause confusion.
## Task Checklist
- [ ] Use the filename (without extension) to self-reference a component
- [ ] Be aware that imported components take precedence over self-reference
- [ ] For clarity in recursive components, consider explicit naming
**Example:**
```vue
{{ item.name }}
```
```vue
```
## Priority: Imports Override Self-Reference
```vue
```
To explicitly self-reference when there's a naming conflict:
```vue
```
## Options API: Explicit Name Option
```vue
```
## Common Use Cases for Self-Reference
1. **Tree structures** - File explorers, org charts
2. **Nested comments** - Reddit-style comment threads
3. **Menu navigation** - Recursive dropdown menus
4. **Category hierarchies** - Product categories, taxonomies
## Avoid Infinite Recursion
```vue
{{ node.name }}
```
## Reference
- [Vue.js Component Registration](https://vuejs.org/guide/components/registration.html)
{{ comment.text }}