useReactor()
Selects state from the Reactor store. Uses shallow comparison to avoid unnecessary re-renders.
Signature
(state: ReactorStore) => T
required
A function that picks values from the store.
Example
Store properties
The store exposes
publish / unpublish; the base Reactor class names the same operations
publishTrack /
unpublishTrack. Use whichever matches your entry
point (hook store vs. class instance).Per-track
pauseTrack /
resumeTrack subscribe to and unsubscribe from an
output track. They are base Reactor methods, not store actions. Reach the instance from a hook
with useReactor((s) => s.internal.reactor) when you need them in React.useReactorMessage()
Subscribes to application-level messages from the model. Handles React lifecycle automatically.
Signature
(message: any) => void
required
Called each time the model sends a message. The shape of
message depends on the model.Example
This hook only receives
application-scoped messages. Internal platform messages are handled by the SDK.useStats()
Returns live WebRTC connection statistics, updated every 2 seconds while connected.
Signature
Example
ConnectionStats for all available fields.
useClipDownload()
Headless primitive for downloading a Clip. Wraps reactor.downloadClipAsFile() and exposes the state of the in-flight download so you can render your own button, progress bar, or menu item.
Signature
string | null
default:"\"reactor-clip.mp4\""
Filename used by the browser save dialog. Pass
null to skip the save dialog and just resolve with the Blob.() => string | Promise<string>
Resolver for the auth token. Required against
https://api.reactor.inc. See Authentication.Example
ClipDownloadButton.