Skip to content

useMounted

Category
Export Size
156 B
Last Changed
2 years ago

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>

Source

SourceDemoDocs

Contributors

Anthony Fu
yanbowen

Changelog

v10.9.0 on 2/27/2024
ee297 - fix: compatible with vue2.7 (#3802)
v10.8.0 on 2/20/2024
2f66e - fix: hold the instance, close #3785, close #3795
v10.0.0-beta.3 on 4/12/2023
1aab1 - fix: check for the current instance

Released under the MIT License.

AI writes code. Judgment ships.
First 500 spots filled. 400 more spots open. Still early access pricing.
Get early access
02
hours
:
09
minutes
:
36
seconds
: