Skip to main content

useCurrentScrollSyncSession

The useCurrentScrollSyncSession hook returns the active scroll sync session.

Returns null if no session is currently active.

Read more about scroll sync here.

import { useCurrentScrollSyncSession } from '@pdftron/collab-react'
export function CurrentScrollSyncSession() {
const currentSession = useCurrentScrollSyncSession();
if(!currentSession) {
return <p>You are not in a scroll sync session</p>
}
return (
<div>
<p>Session: {currentSession.id}</p>
<button onClick={() => currentSession.exit()}>Leave</button>
</div>
)
}