Skip to content

reactiveComputed

Category
Export Size
288 B
Last Changed
3 weeks ago

Computed reactive object. Instead of returning a ref that computed does, reactiveComputed returns a reactive object.

Usage

ts
import { reactiveComputed } from '@vueuse/core'

const state = reactiveComputed(() => {
  return {
    foo: 'bar',
    bar: 'baz',
  }
})

state.bar // 'baz'

Type Declarations

typescript
export type ReactiveComputedReturn<T extends object> = UnwrapNestedRefs<T>
/**
 * Computed reactive object.
 */
export declare function reactiveComputed<T extends object>(
  fn: ComputedGetter<T>,
): ReactiveComputedReturn<T>

Source

SourceDocs

Contributors

Anthony Fu
Robin
Anthony Fu
sibbng
三咲智子 Kevin Deng
qiang

Changelog

v13.1.0 on
c1d6e - feat(shared): ensure return types exists (#4659)
v12.6.0 on
bea31 - fix: computed fn should be ComputedGetter (#4528)
v12.0.0-beta.1 on
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)
v10.3.0 on
17a72 - fix: unwrap reactive type (#3215)

Released under the MIT License.

Save 37% on one year of learning Vue, Includes the Vue.js Master Class.
Get Offer