Computed
const { useComputed: useCounterComputed } = defineModule({ count: 0 })
.computed({
doubled: (state) => state.count * 2,
})
.build();
// Once the computed result changes
// the component will get rerendered.
function Component() {
const { doubled } = useCounterComputed()
return <div>{doubled}</div>
}
The implementation
The getter function
The hooks
Limitations
Last updated