Skip to content

reactiveComputed

Category
Export Size
264 B
Last Changed
7 months ago

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

This function uses Proxy

It is NOT supported by IE 11 or below.

Usage

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

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

state.bar // 'baz'

Type Declarations

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

Source

SourceDocs

Contributors

Anthony Fu
三咲智子 Kevin Deng
qiang

Changelog

v10.3.0 on 7/30/2023
17a72 - fix: unwrap reactive type (#3215)

Released under the MIT License.