R
fn

useMounted

v0.0.1testeddemo

Returns a ref that tracks the mounted state of the component (doesn't track the unmounted state)

Examples

ts
const isMounted = useMounted();
ts
const isMounted = useMounted(getCurrentInstance());

Demo

Loading demo…

Signature

ts
export function useMounted(instance?: ComponentInternalInstance){ ... }

Parameters

ParameterTypeDescription
instance?ComponentInternalInstance | undefinedThe component instance to track the mounted state for

Returns

Readonly<import("vue").Ref<boolean, boolean>>The mounted state of the component