--- title: Locally Registered Components Are Not Available in Descendants impact: HIGH impactDescription: Common source of "component not found" errors in nested components type: gotcha tags: [vue3, component-registration, local-registration, scope, nested-components] --- # Locally Registered Components Are Not Available in Descendants **Impact: HIGH** - Locally registered components are only available in the component where they are registered, NOT in its child or descendant components. This is a common source of "Unknown component" or "Failed to resolve component" errors when developers expect a component registered in a parent to be available in children. ## Task Checklist - [ ] Import and register components in every file where they are used - [ ] Do not expect parent's local components to be available in children - [ ] If a component is needed in many places, consider global registration only as a last resort - [ ] Use IDE auto-import features to simplify repeated imports **Incorrect:** ```vue ``` ```vue ``` **Correct:** ```vue ``` ```vue ``` ## Common Scenarios ### Scenario 1: Deeply Nested Components ```vue ``` ### Scenario 2: Slot Content with Components ```vue ``` ```vue ``` ### Scenario 3: Dynamic Components ```vue ``` ## Why This Design? Local registration provides: 1. **Explicit dependencies** - You can see exactly what each component uses 2. **Tree-shaking** - Unused components are removed from bundles 3. **Clear scope** - No magic or implicit behavior ## Reference - [Vue.js Component Registration - Local Registration](https://vuejs.org/guide/components/registration.html#local-registration)