docs/features/slide-hook.md
Slidev provides a set of hooks to help you manage the slide lifecycle:
import { onSlideEnter, onSlideLeave, useIsSlideActive } from '@slidev/client'
const isActive = useIsSlideActive()
onSlideEnter((to, from) => {
/* Called whenever the slide becomes active */
})
onSlideLeave((to, from) => {
/* Called whenever the slide becomes inactive */
})
You can also use <LinkInline link="guide/global-context" /> to access other useful context information.
::: warning
In the slide component, onMounted and onUnmounted hooks are not available, because the component instance is preserved even when the slide is not active. Use onSlideEnter and onSlideLeave instead.
:::