Skip to content

ecsia-monorepo / react/src / useObserve

Function: useObserve()

ts
function useObserve(term, handler): void;

Defined in: react/src/hooks.ts:96

Lifecycle wrapper over world.observe: register on mount, dispose on unmount — the general escape hatch. The handler receives the pooled EntityRef exactly as core observers do; the pooling contract applies (read fields inside the handler, never store the ref).

Parameters

ParameterType
termObserverTerm
handler(e, ctx) => void

Returns

void

MIT licensed · 0.x, unpublished, experimental.