useMounted
Mounted state in ref.
Demo
mounted
Usage
js
import { useMounted } from '@vueuse/core'
const isMounted = useMounted()Which is essentially a shorthand of:
ts
const isMounted = ref(false)
onMounted(() => {
isMounted.value = true
})Type Declarations
typescript
/**
* Mounted state in ref.
*
* @see https://vueuse.org/useMounted
*/
export declare function useMounted(): Ref<boolean, boolean>Source
Contributors
Changelog
v10.10.0 on 5/27/2024v10.9.0 on 2/27/2024v10.8.0 on 2/20/2024v10.0.0-beta.3 on 4/12/20231aab1 - fix: check for the current instance