@rill/react
React hook for @rill/client. No extra WebRTC.
useCall returns the @rill/client Call, or null until connected. It re-renders on local, remote, state, ended, and error. Do not subscribe to data here — call call.on("data") yourself. Walkthrough: Your app.
npm i @rill/react @rill/clientUntil a v* tag exists, use this repo’s sdk/ workspace.
import { useCall } from "@rill/react";
export function Stage({ url, token }: { url: string; token: string }) {
const call = useCall({ url, token });
if (!call) {
return null;
}
return call.state;
}Hook
useCall(opts: ConnectOptions): Call | nulluseCall— Connects once and re-renders onlocal,remote,state,ended, anderror. Do not subscribe todatahere: rrweb-rate messages would re-render on every payload. Apps that need data callcall.on("data")themselves. NouseDataChannel. Returns the@rill/clientCall, ornulluntil connected.