Computed in vue is used when you define computed values. You can define computed value easily.
let computedVariable:computed<type> = (()=>computeFormula)
import { reactive,computed } from 'Vucript'
const counter:reactive<number> = 0;
const twiceTheCounter:computed<number> = (()=>counter*2);
import { defineComponent, ref, computed } from "vue";
export default defineComponent({
setup() {
const counter = ref<number>(0);
const twiceTheCounter = computed(() => counter.value * 2);
return { counter, twiceTheCounter };
},
});
Like reactive, vucript automatically imports computed from Vue and returns computed value. It's so simple, isn't it?