---
title: Props Are Validated Before Component Instance Creation
impact: MEDIUM
impactDescription: Instance properties like data and computed are unavailable in prop default/validator functions
type: gotcha
tags: [vue3, props, validation, lifecycle, default-values]
---
# Props Are Validated Before Component Instance Creation
**Impact: MEDIUM** - Prop validation and default value functions execute before the component instance is created. This means `this`, `data`, `computed`, injections, and other instance properties are not available inside `default` or `validator` functions.
This timing catches developers who expect to use component state in prop validation logic.
## Task Checklist
- [ ] Never reference `this` or instance properties in prop default/validator functions
- [ ] Use factory functions for object/array defaults that only use the function parameters
- [ ] For validation depending on other props, use the second `props` parameter in validators
- [ ] Move complex validation logic to watchers or lifecycle hooks if instance access is needed
**Incorrect:**
```vue
```
**Correct:**
```vue
```
## Using the `props` Parameter in Validators
Validators receive the full props object as the second parameter for cross-prop validation:
```vue
```
## Using rawProps in Default Functions
Default factory functions receive `rawProps` for accessing other prop values:
```vue
```
## Post-Mount Validation Pattern
For validation that needs instance access, use lifecycle hooks:
```vue
```
## Reference
- [Vue.js Props - Prop Validation](https://vuejs.org/guide/components/props.html#prop-validation)