React hook tracking distributed sync status between client and leader thread.
// Source: https://github.com/livestorejs/livestore | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import React from 'react'
import type { Store, SyncStatus } from '@livestore/livestore'
/**
* React hook that subscribes to sync status changes.
*
* Returns the current synchronization status between the client session and
* the leader thread. The component re-renders whenever the sync status changes.
*
* @example
* ```tsx
* function SyncIndicator() {
* const status = store.useSyncStatus()
* return <span>{status.isSynced ? '✓ Synced' : `Syncing (${status.pendingCount} pending)...`}</span>
* }
* ```
*
* @param options - Options containing the store instance
* @re
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key