Rxova
Skip to content

usePresenceMetadata

function usePresenceMetadata(metadata, options?): void;

Publish what this client wants peers to know about it — a display name, a tab title, a cursor.

Safe to call with a fresh object every render: the value is compared by contents, so an unchanged one announces nothing and re-renders nobody.

usePresenceMetadata({ name: user.name, editing: currentDocId });

Published in an effect rather than during render, because announcing is a side effect on every other tab — and a render that React throws away must not be one other tabs already saw.

ParameterType
metadataunknown
options?UsePeersOptions

void