Function: useSyncStatus()
Function: useSyncStatus()
Section titled “Function: useSyncStatus()”useSyncStatus(
options?):SyncStatus
Defined in: react/src/use-sync-status.ts:65
React hook that returns a reactive SyncStatus snapshot for the
current PlasmaClient. Wraps the existing getOutboxDepth,
navigator.onLine events, and client.onError hook so callers
don’t have to plumb them individually.
function StatusBar() { const { online, outboxDepth, lastError } = useSyncStatus() if (!online) return <Banner>Offline — {outboxDepth} pending</Banner> if (lastError?.kind === "schema-mismatch") return <Reload /> return outboxDepth > 0 ? <Spinner /> : null}Requires the client to have been constructed with an onError
option so error events surface. If yours doesn’t, wire one in — the
hook will still work but lastError stays null.