Skip to main content

useMentions

The useMentions hook returns a list of the current user's mentions for the current document.

Returns an empty array if no document is loaded, or the user has no mentions for the current document.

import { useMentions } from '@pdftron/collab-react'
export function Mentions() {
const mentions = useMentions();
return (
<div>
<p>My mentions</p>
{
mentions.map(mention => {
return (
<div key={mention.id}>
<p>{mention.mentionedBy.userName} - {mention.contents}</p>
</div>
)
})
}
</div>
)
}