Skip to content

useMounted

Mounted state in ref.

Demo

unmounted

Usage

js
import { useMounted } from './'

const isMounted = useMounted()

Which is essentially a shorthand of:

ts
const isMounted = ref(false)

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