Props are like parameters in functions. Use props to customize components.
React's design philosophy is "props are just function arguments."
Vue requires you to explicitly declare which props your component accepts using defineProps().
Props are reactive.
Vue props are deeply immutable from the child's perspective. Children should emit events back to the parent.
Usage
Usage
The Boolean absent props will be cast to false.
An absent optional prop other than Boolean will have undefined value.
The Boolean absent props will be cast to false.
This pattern prevents developers from passing invalid prop combinations.
There are used discriminated unions with TypeScript. A discriminant (usually a literal type like variant: 'text') determines which other properties are valid. You use the never type to explicitly forbid properties in certain branches.
Usage:
When prop validation fails, Vue will produce a console warning (if using the development build).