Setup
Create a client and pass it toMeridianProvider:
Hooks
useGCounter
usePNCounter
useORSet
Define the schema outside the component so its reference is stable:
useLwwRegister
usePresence
Define the schema outside the component. Pass data to enable auto-heartbeat:
data is omitted, the hook subscribes without sending a heartbeat (observe-only).
useAwareness
Ephemeral pub/sub for cursors, selections, and real-time UI state. Updates are fanned out in real time but not persisted.
Define the schema outside the component for a stable reference:
peers excludes the current client. For an accurate visitor count, combine with usePresence:
useCRDTMap
usePendingOpCount
Returns the number of operations buffered locally, waiting to be sent on reconnect. Use it to build a “syncing” indicator:
useMeridianClient
Access the underlying MeridianClient directly:
Requirements
- React 19+
meridian-sdk0.3+