minca
ApiReactFunctions

Function: useLive()

function useLive<T>(
   spaceId, 
   load, 
   deps
): T | undefined;

Defined in: packages/react/src/use-live.ts:16

Loads something from a space, and loads it again whenever that space's records or connection change, locally or by sync.

The named hooks (useRecord, useCollections, …) cover the usual reads; this is for anything else.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
spaceIdstringThe space to follow
load(node) => Promise<T>What to read, given the node
depsreadonly unknown[]When these change, start over

Returns

T | undefined

The latest value, or undefined until the first load finishes

On this page