Skip to main content

useScrollSync

The useScrollSync hook returns an array of available scroll sync sessions for the current document. Returns an empty array if no sessions are available or no document is loaded.

Read more about scroll sync here.

import { useScrollSync } from '@pdftron/collab-react'
export function ScrollSyncSessions() {
const sessions = useScrollSync();
return (
<div>
<p>Scroll sync sessions</P>
{
sessions.map(session => {
<div key={session.id}>
<p>{session.leader?.userName}'s session</p>
<button onClick={() => session.join()}>Join session</button>
</div>
})
}
</div>
)
}