Skip to content

Slide Hooks ​

Slidev provides a set of hooks to help you manage the slide lifecycle:

ts
import { 
onSlideEnter
,
onSlideLeave
,
useIsSlideActive
} from '@slidev/client'
const
isActive
=
useIsSlideActive
()
onSlideEnter
(() => {
/* Called whenever the slide becomes active */ })
onSlideLeave
(() => {
/* Called whenever the slide becomes inactive */ })

You can also use 📖 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.

Released under the MIT License.