AI agents: fetch the documentation index at llms.txt. Markdown versions are available by appending .md to any page URL, including this page's markdown.
Collaborative editing hooks
React hooks for Yjs collaborative document editing and presence management.
Integrate Yjs CRDT documents with React components. Requires the yjs peer dependency and a configured Yjs transport.
Prerequisites
yjspeer dependency installed- Yjs transport configured via
yjsTransport - Sync client accessible via
SyncProvider
import { createSyncClient } from "@stratasync/client";
const client = createSyncClient({
// ... storage, transport, reactivity
yjsTransport: createYjsTransport({
wsEndpoint: "wss://api.example.com/yjs",
}),
});If client.yjs is undefined (no Yjs transport configured), useYjsDocument sets an error state and operations become no-ops.