Back to Vueuse

useMounted

packages/core/useMounted/index.md

14.3.0255 B
Original Source

useMounted

Mounted state in ref.

Usage

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

const isMounted = useMounted()

Which is essentially a shorthand of:

ts
const isMounted = ref(false)

onMounted(() => {
  isMounted.value = true
})