Dealing with Data: ref() and reactive()
Learn about the ref() and reactive() functions in the Composition API.
Overview
What about working with the component state if there’s no access to the instance? Vue 3 provides tools for creating reactive data within the setup()
method.
The ref()
function
The ref()
function is used to create reactive primitive values (such as strings, numbers, booleans, and so on). It creates a wrapper around the value, allowing it to be passed by reference:
Get hands-on with 1400+ tech skills courses.