Category | Reactivity |
---|---|
Export Size | 398 B |
Last Changed | last year |
Alias | eagerComputed |
Eager computed without lazy evaluation.
Learn more at Vue: When a computed property can be the wrong tool.
computed()
when you have a complex calculation going on, which can actually profit from caching and lazy evaluation and should only be (re-)calculated if really necessary.computedEager()
when you have a simple operation, with a rarely changing return value – often a boolean.import { computedEager } from '@vueuse/core' const todos = ref([]) const hasOpenTodos = computedEager(() => !!todos.length) console.log(hasOpenTodos.value) // false toTodos.value.push({ title: 'Learn Vue' }) console.log(hasOpenTodos.value) // true
export declare function computedEager<T>( fn: () => T, options?: WatchOptionsBase ): Readonly<Ref<T>> export { computedEager as eagerComputed }
© 2019-present Anthony Fu
Licensed under the MIT License.
https://vueuse.org/shared/computedEager/