Skip to content

LiveStoreContext

const LiveStoreContext: Context<undefined | { stage: "running"; store: Store<Any, { }> & ReactApi; }>

Defined in: packages/@livestore/react/src/LiveStoreContext.ts:39

React context for accessing the LiveStore instance.

This context is provided by <LiveStoreProvider> and consumed by hooks like useStore(), useQuery(), and useClientDocument().

The context value is undefined until the Store has finished booting, then transitions to { stage: 'running', store: ... }.

// Typically you don't use this directly—use useStore() instead
const context = React.useContext(LiveStoreContext)
if (context?.stage === 'running') {
console.log('Store ready:', context.store.storeId)
}