Api referenceReact
usePresence
Returns the list of other users currently in the room with their metadata.
Signature
Returns
An array of PresenceUser objects for everyone in the room except yourself.
Re-renders
The hook re-renders when:
- A user joins the room
- A user leaves the room
- A user updates their presence metadata (via
updatePresenceoruseMyPresence)
Usage
Initial state
The server sends a full room snapshot (all current users) when you join. usePresence is seeded from this snapshot, so the hook is never empty for a room that already has users when you connect.
Requirements
Must be called inside a <FlockProvider>. Throws if used outside one.
See also
- Presence metadata guide for using names, colors, avatars, and custom fields
useMyPresenceto read and update your own presence