1

Get the usePresenceUsers Hook

Import the usePresenceUsers hook.

import { usePresenceUsers } from '@veltdev/react';
const presenceUsers = usePresenceUsers()
2

Display Presence Users List with your own UI

The usePresenceUsers hook will return an array of User objects.

You can map the Presence Users List to generate your own custom UI.

return (
  <div>
    Presence Users: {presenceUsers.length}
    {
      presenceUsers.map( x => <div>{x.name} </div>)
    }
  </div>
)

The hook will automatically unsubscribe from the subscription when the component dismounts.