Content Deep Dive
Understanding the new script setup with defineProps & defineEmits in Vue 3.2
Blog post from Netlify
Post Details
Company
Date Published
Author
Ekene Eze
Word Count
913
Language
English
Hacker News Points
-
Summary
Vue 3.2 has introduced a new feature called `<script setup>` which aims to simplify the Composition API usage inside Single File Components (SFCs). With `<script setup>`, developers can define variables and use them in the template without needing named or default exports, reducing code bulk in larger codebases. This feature also allows importing components without extra config or bindings, making it easier to pass props and emit events between components. Additionally, `<script setup>` ships with APIs like `defineProps` and `defineEmits`, which enable declaring props and emits, making it easier to handle reactive data and communication between components.