Api referenceReact
useMyPresence
Returns your own presence metadata and an updater function.
Signature
Returns
A tuple of [currentMetadata, updateFn].
currentMetadata— your current presence metadata (the merged result of initialmetadataprop plus any updates you've sent).updateFn— a function that merges a partial update into your metadata and broadcasts it to the room.
Re-renders
The hook re-renders immediately when you call the updater (optimistic update — your own change is reflected locally before the server round-trip).
Usage
Metadata merging
Updates are merged, not replaced. Calling updateMe({ status: "idle" }) preserves your existing name and color.
Other users will see the merged metadata in usePresence().
Custom fields
UserMetadata has an open index signature so you can add any extra fields your app needs:
Requirements
Must be called inside a <FlockProvider>. Throws if used outside one.
See also
- Presence metadata guide
usePresenceto read other users' metadata