Skip to main content

useAnnotations

The useAnnotations hook returns all annotations that belong to the current document.

Returns an empty array if no document is loaded, or the document has no annotations.

import { useAnnotations } from '@pdftron/collab-react'
export function AnnotationList() {
const annotations = useAnnotations();
return (
<div>
{
annotations.map(annotation => {
return (
<div key={annotation.id}>
<p>{annotation.author.userName} - {annotation.contents}</p>
</div>
)
})
}
</div>
)
}