Script Setup and Reactivity
Understand the benefits of the script setup syntax and how to add reactivity.
We'll cover the following...
We'll cover the following...
Script setup
This example shows the Composition API, which includes a setup section:
Lines 4–20: This is the
setup()wrapper containing all of the composition code.
While still valid to use, we also have a way to make this shorter and cleaner, using <script setup> inside single file components. We briefly looked at this in earlier examples, and it is now the recommended syntax. It involves removing the setup() wrapper, export default, and the return section. Our above example ...