Reactive Values & Functions
Ref
& Reactive
are used when you want to define reactive variable in Vue Composition API.
Ref
is often used for primitive types and Reactive is often used Object types in Vue 3.
However, vucript doesn't differentiate Ref and Reactive. You can just use reactive type whether or not you are defining object type variables.
This is how to use reactive in Vucript.
Let's look at some examples!
The code above is compiled to
With Vucript, you don't have to write return values and you can write type annotation to the right side of variable name. In addition, Vucript imports ref and reactive or both from vue automatically.
Please don't use const when defining variable of primitive types if you want to modify the value.
You don't have to write import { something } from 'Vucript'
, because Vucript type definitions are only used for type assertion.
Modifying Reactive Values by Functions
In Vucript, you don't have to add .value
to your ref value. Just modify value like normal javascript primitive value.
In addition, Vucript automatically returns functions you defined. You can use both normal functions and arrow functions!
Type Definiton for Reactive of Vucript
Last updated
Was this helpful?