Performance: Prop types and validation
MEDIUM IMPACT
This affects the initial rendering speed and runtime performance by adding checks when components receive props.
<script setup> const props = defineProps({ title: { type: String, required: true }, count: { type: Number, default: 0 } }) </script>
<script setup> const props = defineProps({}) // No prop validation </script>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No prop validation | No extra DOM ops | 0 | 0 | [OK] Good for raw speed but risky |
| Basic prop types with required/default | No extra DOM ops | 0 | 0 | [!] OK with minor runtime cost |
| Heavy custom validators | No extra DOM ops | 0 | 0 | [X] Bad due to blocking JS execution |