useProjection<
T
>(
registry: ChannelRegistry | null | undefined,
specFactory: () => ProjectionSpec| Name | Type | Description |
|---|---|---|
registry* | ChannelRegistry | null | undefined | |
specFactory* | () => ProjectionSpec<T> | |
key* | string | |
initialValue* | T |
React-side primitive that composes ChannelRegistry.acquire with useSyncExternalStore.
Contract:
key changes) this hook acquires a
ref-counted projection from the registry and subscribes to its
store. React re-renders automatically whenever the store's
snapshot changes.key changes) the previous acquisition is
released. If this was the last consumer of that spec, the
registry closes the underlying server subscription.The first render (before useEffect runs) returns initialValue.
Subsequent renders read from the acquired store.
Framework bindings for Vue/Svelte/Angular follow the same shape —
acquire on setup/mount, release on scope-dispose/unmount — but use
their own reactivity primitive instead of useSyncExternalStore.