A Vue 3 composition API utility that safely calls onMounted when inside component setup context, and gracefully handles calls outside setup without errors.
npm install vue-try-on-mountedimport { tryOnMounted } from 'vue-try-on-mounted'
tryOnMounted(() => {
console.log('Component mounted')
})
console.log('Mount handler registered')MIT
Extracted from VueUse for standalone use.