javascript / beginner
Snippet
Defining Component Props
The defineProps function allows a component to receive data from its parent. This makes your components flexible and reusable across different parts of your application.
snippet.js
1
const props = defineProps(['username', 'age']);
vue
Breakdown
1
const props = defineProps(['username', 'age']);
Declares two expected properties, 'username' and 'age', which can be passed to this component from the outside.