Skip to content

reactiveComputed

Category
Export Size
288 B
Last Changed
5 months 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

ts
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.

Join the Biggest FREE AI-Driven Development Event for Vue Developers
Save My Seat